diff --git a/lodash.md b/lodash.md index bea485914..77a9174d1 100644 --- a/lodash.md +++ b/lodash.md @@ -1 +1 @@ -lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without \ No newline at end of file +lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference \ No newline at end of file diff --git a/src/core/lodash.js b/src/core/lodash.js index af7e67449..3041a41ab 100644 --- a/src/core/lodash.js +++ b/src/core/lodash.js @@ -1,7 +1,7 @@ /** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without"` + * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -5323,6 +5323,33 @@ return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } + /** + * Creates an array of `array` values not included in the other given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. The order and references of result values are + * determined by the first array. + * + * **Note:** Unlike `_.pullAll`, this method returns a new array. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @see _.without, _.xor + * @example + * + * _.difference([2, 1], [2, 3]); + * // => [1] + */ + var difference = baseRest(function(array, values) { + return isArrayLikeObject(array) + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; + }); + /** * Creates a slice of `array` with `n` elements dropped from the beginning. * @@ -9374,6 +9401,7 @@ lodash.defaults = defaults; lodash.defer = defer; lodash.delay = delay; + lodash.difference = difference; lodash.drop = drop; lodash.filter = filter; lodash.flatten = flatten;