mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 23:37:49 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import createCompounder from '../internal/createCompounder';
|
||||
|
||||
/**
|
||||
* Converts `string` to camel case.
|
||||
* See [Wikipedia](https://en.wikipedia.org/wiki/CamelCase) for more details.
|
||||
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import baseToString from '../internal/baseToString';
|
||||
import deburrLetter from '../internal/deburrLetter';
|
||||
|
||||
/**
|
||||
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
||||
*/
|
||||
var reComboMarks = /[\u0300-\u036f\ufe20-\ufe23]/g;
|
||||
|
||||
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
|
||||
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
||||
|
||||
/**
|
||||
* Deburrs `string` by converting latin-1 supplementary letters to basic latin letters.
|
||||
* See [Wikipedia](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
||||
* for more details.
|
||||
* Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
||||
* to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -21,7 +25,7 @@ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
||||
*/
|
||||
function deburr(string) {
|
||||
string = baseToString(string);
|
||||
return string && string.replace(reLatin1, deburrLetter);
|
||||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMarks, '');
|
||||
}
|
||||
|
||||
export default deburr;
|
||||
|
||||
@@ -23,9 +23,8 @@ var reUnescapedHtml = /[&<>"'`]/g,
|
||||
* [#108](https://html5sec.org/#108), and [#133](https://html5sec.org/#133) of
|
||||
* the [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.
|
||||
*
|
||||
* When working with HTML you should always quote attribute values to reduce
|
||||
* XSS vectors. See [Ryan Grove's article](http://wonko.com/post/html-escaping)
|
||||
* for more details.
|
||||
* When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
|
||||
* to reduce XSS vectors.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import baseToString from '../internal/baseToString';
|
||||
|
||||
/**
|
||||
* Used to match `RegExp` special characters.
|
||||
* See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special)
|
||||
* for more details.
|
||||
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).
|
||||
* In addition to special characters the forward slash is escaped to allow for
|
||||
* easier `eval` use and `Function` compilation.
|
||||
*/
|
||||
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
|
||||
reHasRegExpChars = RegExp(reRegExpChars.source);
|
||||
|
||||
/**
|
||||
* Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*",
|
||||
* "+", "(", ")", "[", "]", "{" and "}" in `string`.
|
||||
* Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
|
||||
* "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -20,7 +20,7 @@ var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
|
||||
* @example
|
||||
*
|
||||
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
||||
* // => '\[lodash\]\(https://lodash\.com/\)'
|
||||
* // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
|
||||
*/
|
||||
function escapeRegExp(string) {
|
||||
string = baseToString(string);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import createCompounder from '../internal/createCompounder';
|
||||
|
||||
/**
|
||||
* Converts `string` to kebab case.
|
||||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for
|
||||
* more details.
|
||||
* Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import baseToString from '../internal/baseToString';
|
||||
import createPad from '../internal/createPad';
|
||||
import createPadding from '../internal/createPadding';
|
||||
import root from '../internal/root';
|
||||
|
||||
/** Native method references. */
|
||||
@@ -10,9 +10,8 @@ var ceil = Math.ceil,
|
||||
var nativeIsFinite = root.isFinite;
|
||||
|
||||
/**
|
||||
* Pads `string` on the left and right sides if it is shorter then the given
|
||||
* padding length. The `chars` string may be truncated if the number of padding
|
||||
* characters can't be evenly divided by the padding length.
|
||||
* Pads `string` on the left and right sides if it is shorter than `length`.
|
||||
* Padding characters are truncated if they can't be evenly divided by `length`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -44,7 +43,7 @@ function pad(string, length, chars) {
|
||||
leftLength = floor(mid),
|
||||
rightLength = ceil(mid);
|
||||
|
||||
chars = createPad('', rightLength, chars);
|
||||
chars = createPadding('', rightLength, chars);
|
||||
return chars.slice(0, leftLength) + string + chars;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import baseToString from '../internal/baseToString';
|
||||
import createPad from '../internal/createPad';
|
||||
import createPadDir from '../internal/createPadDir';
|
||||
|
||||
/**
|
||||
* Pads `string` on the left side if it is shorter then the given padding
|
||||
* length. The `chars` string may be truncated if the number of padding
|
||||
* characters exceeds the padding length.
|
||||
* Pads `string` on the left side if it is shorter than `length`. Padding
|
||||
* characters are truncated if they exceed `length`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -24,9 +22,6 @@ import createPad from '../internal/createPad';
|
||||
* _.padLeft('abc', 3);
|
||||
* // => 'abc'
|
||||
*/
|
||||
function padLeft(string, length, chars) {
|
||||
string = baseToString(string);
|
||||
return string && (createPad(string, length, chars) + string);
|
||||
}
|
||||
var padLeft = createPadDir();
|
||||
|
||||
export default padLeft;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import baseToString from '../internal/baseToString';
|
||||
import createPad from '../internal/createPad';
|
||||
import createPadDir from '../internal/createPadDir';
|
||||
|
||||
/**
|
||||
* Pads `string` on the right side if it is shorter then the given padding
|
||||
* length. The `chars` string may be truncated if the number of padding
|
||||
* characters exceeds the padding length.
|
||||
* Pads `string` on the right side if it is shorter than `length`. Padding
|
||||
* characters are truncated if they exceed `length`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -24,9 +22,6 @@ import createPad from '../internal/createPad';
|
||||
* _.padRight('abc', 3);
|
||||
* // => 'abc'
|
||||
*/
|
||||
function padRight(string, length, chars) {
|
||||
string = baseToString(string);
|
||||
return string && (string + createPad(string, length, chars));
|
||||
}
|
||||
var padRight = createPadDir(true);
|
||||
|
||||
export default padRight;
|
||||
|
||||
@@ -25,8 +25,8 @@ var nativeParseInt = root.parseInt;
|
||||
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
|
||||
* in which case a `radix` of `16` is used.
|
||||
*
|
||||
* **Note:** This method aligns with the ES5 implementation of `parseInt`.
|
||||
* See the [ES5 spec](https://es5.github.io/#E) for more details.
|
||||
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)
|
||||
* of `parseInt`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import createCompounder from '../internal/createCompounder';
|
||||
|
||||
/**
|
||||
* Converts `string` to snake case.
|
||||
* See [Wikipedia](https://en.wikipedia.org/wiki/Snake_case) for more details.
|
||||
* Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import createCompounder from '../internal/createCompounder';
|
||||
|
||||
/**
|
||||
* Converts `string` to start case.
|
||||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage)
|
||||
* for more details.
|
||||
* Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -16,9 +16,7 @@ var reEmptyStringLeading = /\b__p \+= '';/g,
|
||||
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
||||
|
||||
/**
|
||||
* Used to match ES template delimiters.
|
||||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components)
|
||||
* for more details.
|
||||
* Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components).
|
||||
*/
|
||||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
||||
|
||||
@@ -35,9 +33,9 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
||||
* properties may be accessed as free variables in the template. If a setting
|
||||
* object is provided it takes precedence over `_.templateSettings` values.
|
||||
*
|
||||
* **Note:** In the development build `_.template` utilizes sourceURLs for easier debugging.
|
||||
* See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
||||
* for more details.
|
||||
* **Note:** In the development build `_.template` utilizes
|
||||
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
||||
* for easier debugging.
|
||||
*
|
||||
* For more information on precompiling templates see
|
||||
* [lodash's custom builds documentation](https://lodash.com/custom-builds).
|
||||
|
||||
@@ -24,7 +24,7 @@ import trimmedRightIndex from '../internal/trimmedRightIndex';
|
||||
* // => 'abc'
|
||||
*
|
||||
* _.map([' foo ', ' bar '], _.trim);
|
||||
* // => ['foo', 'bar]
|
||||
* // => ['foo', 'bar']
|
||||
*/
|
||||
function trim(string, chars, guard) {
|
||||
var value = string;
|
||||
|
||||
@@ -43,7 +43,7 @@ var reFlags = /\w*$/;
|
||||
* 'length': 24,
|
||||
* 'separator': /,? +/
|
||||
* });
|
||||
* //=> 'hi-diddly-ho there...'
|
||||
* // => 'hi-diddly-ho there...'
|
||||
*
|
||||
* _.trunc('hi-diddly-ho there, neighborino', {
|
||||
* 'omission': ' [...]'
|
||||
|
||||
Reference in New Issue
Block a user