diff options
Diffstat (limited to 'deps/npm/node_modules/lodash.without/index.js')
-rw-r--r-- | deps/npm/node_modules/lodash.without/index.js | 93 |
1 files changed, 8 insertions, 85 deletions
diff --git a/deps/npm/node_modules/lodash.without/index.js b/deps/npm/node_modules/lodash.without/index.js index 34e2da80f0..049466d2aa 100644 --- a/deps/npm/node_modules/lodash.without/index.js +++ b/deps/npm/node_modules/lodash.without/index.js @@ -1,21 +1,14 @@ /** - * lodash 4.0.2 (Custom Build) <https://lodash.com/> + * lodash 4.1.1 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ -var SetCache = require('lodash._setcache'), - arrayIncludes = require('lodash._arrayincludes'), - arrayIncludesWith = require('lodash._arrayincludeswith'), - arrayMap = require('lodash._arraymap'), - cacheHas = require('lodash._cachehas'), +var baseDifference = require('lodash._basedifference'), rest = require('lodash.rest'); -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -23,19 +16,6 @@ var MAX_SAFE_INTEGER = 9007199254740991; var funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; -/** - * The base implementation of `_.unary` without support for storing wrapper metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -46,61 +26,6 @@ var objectProto = Object.prototype; var objectToString = objectProto.toString; /** - * The base implementation of methods like `_.difference` without support for - * excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ -function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; -} - -/** * The base implementation of `_.property` without support for deep paths. * * @private @@ -126,7 +51,7 @@ function baseProperty(key) { var getLength = baseProperty('length'); /** - * Creates an array excluding all provided values using + * Creates an array excluding all given values using * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * @@ -154,7 +79,6 @@ var without = rest(function(array, values) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. @@ -173,8 +97,7 @@ var without = rest(function(array, values) { * // => false */ function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); + return value != null && isLength(getLength(value)) && !isFunction(value); } /** @@ -183,7 +106,6 @@ function isArrayLike(value) { * * @static * @memberOf _ - * @type Function * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. @@ -223,8 +145,8 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -254,7 +176,8 @@ function isFunction(value) { * // => false */ function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** |