mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Rename _.contains to _.includes.
This commit is contained in:
37
lodash.js
37
lodash.js
@@ -1006,16 +1006,16 @@
|
||||
* `zip`, and `zipObject`
|
||||
*
|
||||
* The non-chainable wrapper functions are:
|
||||
* `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `contains`,
|
||||
* `deburr`, endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
|
||||
* `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
|
||||
* `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, isDate`,
|
||||
* `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`, `isFunction`,
|
||||
* `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
|
||||
* `isRegExp`, `isString`, `isUndefined`, `join`, `kebabCase`, `last`,
|
||||
* `lastIndexOf`, `max`, `min`, `noConflict`, `now`, `pad`, `padLeft`, `padRight`,
|
||||
* `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
|
||||
* `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
||||
* `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`,
|
||||
* `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
|
||||
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`,
|
||||
* `identity`, `includes`, `indexOf`, `isArguments`, `isArray`, `isBoolean`,
|
||||
* `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`,
|
||||
* `isFunction`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`,
|
||||
* `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `kebabCase`,
|
||||
* `last`, `lastIndexOf`, `max`, `min`, `noConflict`, `now`, `pad`, `padLeft`,
|
||||
* `padRight`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`,
|
||||
* `result`, `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
||||
* `sortedLastIndex`, `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`,
|
||||
* `trunc`, `unescape`, `uniqueId`, `value`, and `words`
|
||||
*
|
||||
@@ -5065,7 +5065,7 @@
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias include
|
||||
* @alias contains, include
|
||||
* @category Collection
|
||||
* @param {Array|Object|string} collection The collection to search.
|
||||
* @param {*} target The value to search for.
|
||||
@@ -5073,19 +5073,19 @@
|
||||
* @returns {boolean} Returns `true` if a matching element is found, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.contains([1, 2, 3], 1);
|
||||
* _.includes([1, 2, 3], 1);
|
||||
* // => true
|
||||
*
|
||||
* _.contains([1, 2, 3], 1, 2);
|
||||
* _.includes([1, 2, 3], 1, 2);
|
||||
* // => false
|
||||
*
|
||||
* _.contains({ 'user': 'fred', 'age': 40 }, 'fred');
|
||||
* _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
|
||||
* // => true
|
||||
*
|
||||
* _.contains('pebbles', 'eb');
|
||||
* _.includes('pebbles', 'eb');
|
||||
* // => true
|
||||
*/
|
||||
function contains(collection, target, fromIndex) {
|
||||
function includes(collection, target, fromIndex) {
|
||||
var length = collection ? collection.length : 0;
|
||||
|
||||
if (!isLength(length)) {
|
||||
@@ -10012,7 +10012,6 @@
|
||||
lodash.capitalize = capitalize;
|
||||
lodash.clone = clone;
|
||||
lodash.cloneDeep = cloneDeep;
|
||||
lodash.contains = contains;
|
||||
lodash.deburr = deburr;
|
||||
lodash.endsWith = endsWith;
|
||||
lodash.escape = escape;
|
||||
@@ -10028,6 +10027,7 @@
|
||||
lodash.first = first;
|
||||
lodash.has = has;
|
||||
lodash.identity = identity;
|
||||
lodash.includes = includes;
|
||||
lodash.indexOf = indexOf;
|
||||
lodash.isArguments = isArguments;
|
||||
lodash.isArray = isArray;
|
||||
@@ -10084,11 +10084,12 @@
|
||||
// Add aliases.
|
||||
lodash.all = every;
|
||||
lodash.any = some;
|
||||
lodash.contains = includes;
|
||||
lodash.detect = find;
|
||||
lodash.foldl = reduce;
|
||||
lodash.foldr = reduceRight;
|
||||
lodash.head = first;
|
||||
lodash.include = contains;
|
||||
lodash.include = includes;
|
||||
lodash.inject = reduce;
|
||||
|
||||
mixin(lodash, (function() {
|
||||
|
||||
Reference in New Issue
Block a user