mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
define(['../internal/createCompounder'], function(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,12 +1,16 @@
|
||||
define(['../internal/baseToString', '../internal/deburrLetter'], function(baseToString, 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 _
|
||||
@@ -20,7 +24,7 @@ define(['../internal/baseToString', '../internal/deburrLetter'], function(baseTo
|
||||
*/
|
||||
function deburr(string) {
|
||||
string = baseToString(string);
|
||||
return string && string.replace(reLatin1, deburrLetter);
|
||||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMarks, '');
|
||||
}
|
||||
|
||||
return deburr;
|
||||
|
||||
@@ -22,9 +22,8 @@ define(['../internal/baseToString', '../internal/escapeHtmlChar'], function(base
|
||||
* [#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 @@
|
||||
define(['../internal/baseToString'], function(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 @@ define(['../internal/baseToString'], function(baseToString) {
|
||||
* @example
|
||||
*
|
||||
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
||||
* // => '\[lodash\]\(https://lodash\.com/\)'
|
||||
* // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
|
||||
*/
|
||||
function escapeRegExp(string) {
|
||||
string = baseToString(string);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
define(['../internal/createCompounder'], function(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,4 +1,4 @@
|
||||
define(['../internal/baseToString', '../internal/createPad', '../internal/root'], function(baseToString, createPad, root) {
|
||||
define(['../internal/baseToString', '../internal/createPadding', '../internal/root'], function(baseToString, createPadding, root) {
|
||||
|
||||
/** Native method references. */
|
||||
var ceil = Math.ceil,
|
||||
@@ -8,9 +8,8 @@ define(['../internal/baseToString', '../internal/createPad', '../internal/root']
|
||||
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 _
|
||||
@@ -42,7 +41,7 @@ define(['../internal/baseToString', '../internal/createPad', '../internal/root']
|
||||
leftLength = floor(mid),
|
||||
rightLength = ceil(mid);
|
||||
|
||||
chars = createPad('', rightLength, chars);
|
||||
chars = createPadding('', rightLength, chars);
|
||||
return chars.slice(0, leftLength) + string + chars;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
define(['../internal/baseToString', '../internal/createPad'], function(baseToString, createPad) {
|
||||
define(['../internal/createPadDir'], function(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 _
|
||||
@@ -23,10 +22,7 @@ define(['../internal/baseToString', '../internal/createPad'], function(baseToStr
|
||||
* _.padLeft('abc', 3);
|
||||
* // => 'abc'
|
||||
*/
|
||||
function padLeft(string, length, chars) {
|
||||
string = baseToString(string);
|
||||
return string && (createPad(string, length, chars) + string);
|
||||
}
|
||||
var padLeft = createPadDir();
|
||||
|
||||
return padLeft;
|
||||
});
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
define(['../internal/baseToString', '../internal/createPad'], function(baseToString, createPad) {
|
||||
define(['../internal/createPadDir'], function(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 _
|
||||
@@ -23,10 +22,7 @@ define(['../internal/baseToString', '../internal/createPad'], function(baseToStr
|
||||
* _.padRight('abc', 3);
|
||||
* // => 'abc'
|
||||
*/
|
||||
function padRight(string, length, chars) {
|
||||
string = baseToString(string);
|
||||
return string && (string + createPad(string, length, chars));
|
||||
}
|
||||
var padRight = createPadDir(true);
|
||||
|
||||
return padRight;
|
||||
});
|
||||
|
||||
@@ -23,8 +23,8 @@ define(['../internal/isIterateeCall', '../internal/root', './trim'], function(is
|
||||
* `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 @@
|
||||
define(['../internal/createCompounder'], function(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 @@
|
||||
define(['../internal/createCompounder'], function(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 _
|
||||
|
||||
@@ -9,9 +9,7 @@ define(['../internal/assignOwnDefaults', '../utility/attempt', '../internal/base
|
||||
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;
|
||||
|
||||
@@ -28,9 +26,9 @@ define(['../internal/assignOwnDefaults', '../utility/attempt', '../internal/base
|
||||
* 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).
|
||||
|
||||
@@ -19,7 +19,7 @@ define(['../internal/baseToString', '../internal/charsLeftIndex', '../internal/c
|
||||
* // => 'abc'
|
||||
*
|
||||
* _.map([' foo ', ' bar '], _.trim);
|
||||
* // => ['foo', 'bar]
|
||||
* // => ['foo', 'bar']
|
||||
*/
|
||||
function trim(string, chars, guard) {
|
||||
var value = string;
|
||||
|
||||
@@ -40,7 +40,7 @@ define(['../internal/baseToString', '../internal/isIterateeCall', '../lang/isObj
|
||||
* '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