lodash.some
Advanced tools
+597
-45
| /** | ||
| * lodash 3.2.3 (Custom Build) <https://lodash.com/> | ||
| * Build: `lodash modern modularize exports="npm" -o ./` | ||
| * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
| * lodash 4.0.0 (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-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
| * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
| * Available under MIT license <https://lodash.com/license> | ||
| */ | ||
| var baseCallback = require('lodash._basecallback'), | ||
| baseEach = require('lodash._baseeach'), | ||
| isIterateeCall = require('lodash._isiterateecall'), | ||
| isArray = require('lodash.isarray'); | ||
| var baseEach = require('lodash._baseeach'), | ||
| baseIsEqual = require('lodash._baseisequal'), | ||
| baseIsMatch = require('lodash._baseismatch'), | ||
| get = require('lodash.get'), | ||
| hasIn = require('lodash.hasin'), | ||
| toPairs = require('lodash.topairs'); | ||
| /** Used to compose bitmasks for comparison styles. */ | ||
| var UNORDERED_COMPARE_FLAG = 1, | ||
| PARTIAL_COMPARE_FLAG = 2; | ||
| /** Used as references for various `Number` constants. */ | ||
| var INFINITY = 1 / 0, | ||
| MAX_SAFE_INTEGER = 9007199254740991; | ||
| /** `Object#toString` result references. */ | ||
| var funcTag = '[object Function]', | ||
| genTag = '[object GeneratorFunction]', | ||
| symbolTag = '[object Symbol]'; | ||
| /** Used to match property names within property paths. */ | ||
| var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, | ||
| reIsPlainProp = /^\w*$/, | ||
| rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; | ||
| /** Used to match backslashes in property paths. */ | ||
| var reEscapeChar = /\\(\\)?/g; | ||
| /** Used to detect unsigned integer values. */ | ||
| var reIsUint = /^(?:0|[1-9]\d*)$/; | ||
| /** | ||
| * A specialized version of `_.some` for arrays without support for callback | ||
| * shorthands and `this` binding. | ||
| * A specialized version of `_.some` for arrays without support for iteratee | ||
| * shorthands. | ||
| * | ||
@@ -21,4 +47,3 @@ * @private | ||
| * @param {Function} predicate The function invoked per iteration. | ||
| * @returns {boolean} Returns `true` if any element passes the predicate check, | ||
| * else `false`. | ||
| * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. | ||
| */ | ||
@@ -38,10 +63,150 @@ function arraySome(array, predicate) { | ||
| /** | ||
| * The base implementation of `_.some` without support for callback shorthands | ||
| * and `this` binding. | ||
| * Checks if `value` is a valid array-like index. | ||
| * | ||
| * @private | ||
| * @param {Array|Object|string} collection The collection to iterate over. | ||
| * @param {*} value The value to check. | ||
| * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. | ||
| * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. | ||
| */ | ||
| function isIndex(value, length) { | ||
| value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; | ||
| length = length == null ? MAX_SAFE_INTEGER : length; | ||
| return value > -1 && value % 1 == 0 && value < length; | ||
| } | ||
| /** Used for built-in method references. */ | ||
| var objectProto = global.Object.prototype; | ||
| /** | ||
| * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
| * of values. | ||
| */ | ||
| var objectToString = objectProto.toString; | ||
| /** Built-in value references. */ | ||
| var _Symbol = global.Symbol; | ||
| /** Used to convert symbols to primitives and strings. */ | ||
| var symbolProto = _Symbol ? _Symbol.prototype : undefined, | ||
| symbolToString = _Symbol ? symbolProto.toString : undefined; | ||
| /** | ||
| * The base implementation of `_.get` without support for default values. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @param {Array|string} path The path of the property to get. | ||
| * @returns {*} Returns the resolved value. | ||
| */ | ||
| function baseGet(object, path) { | ||
| path = isKey(path, object) ? [path + ''] : baseToPath(path); | ||
| var index = 0, | ||
| length = path.length; | ||
| while (object != null && index < length) { | ||
| object = object[path[index++]]; | ||
| } | ||
| return (index && index == length) ? object : undefined; | ||
| } | ||
| /** | ||
| * The base implementation of `_.iteratee`. | ||
| * | ||
| * @private | ||
| * @param {*} [value=_.identity] The value to convert to an iteratee. | ||
| * @returns {Function} Returns the iteratee. | ||
| */ | ||
| function baseIteratee(value) { | ||
| var type = typeof value; | ||
| if (type == 'function') { | ||
| return value; | ||
| } | ||
| if (value == null) { | ||
| return identity; | ||
| } | ||
| if (type == 'object') { | ||
| return isArray(value) | ||
| ? baseMatchesProperty(value[0], value[1]) | ||
| : baseMatches(value); | ||
| } | ||
| return property(value); | ||
| } | ||
| /** | ||
| * The base implementation of `_.matches` which doesn't clone `source`. | ||
| * | ||
| * @private | ||
| * @param {Object} source The object of property values to match. | ||
| * @returns {Function} Returns the new function. | ||
| */ | ||
| function baseMatches(source) { | ||
| var matchData = getMatchData(source); | ||
| if (matchData.length == 1 && matchData[0][2]) { | ||
| var key = matchData[0][0], | ||
| value = matchData[0][1]; | ||
| return function(object) { | ||
| if (object == null) { | ||
| return false; | ||
| } | ||
| return object[key] === value && | ||
| (value !== undefined || (key in Object(object))); | ||
| }; | ||
| } | ||
| return function(object) { | ||
| return object === source || baseIsMatch(object, source, matchData); | ||
| }; | ||
| } | ||
| /** | ||
| * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. | ||
| * | ||
| * @private | ||
| * @param {string} path The path of the property to get. | ||
| * @param {*} srcValue The value to match. | ||
| * @returns {Function} Returns the new function. | ||
| */ | ||
| function baseMatchesProperty(path, srcValue) { | ||
| return function(object) { | ||
| var objValue = get(object, path); | ||
| return (objValue === undefined && objValue === srcValue) | ||
| ? hasIn(object, path) | ||
| : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); | ||
| }; | ||
| } | ||
| /** | ||
| * The base implementation of `_.property` without support for deep paths. | ||
| * | ||
| * @private | ||
| * @param {string} key The key of the property to get. | ||
| * @returns {Function} Returns the new function. | ||
| */ | ||
| function baseProperty(key) { | ||
| return function(object) { | ||
| return object == null ? undefined : object[key]; | ||
| }; | ||
| } | ||
| /** | ||
| * A specialized version of `baseProperty` which supports deep paths. | ||
| * | ||
| * @private | ||
| * @param {Array|string} path The path of the property to get. | ||
| * @returns {Function} Returns the new function. | ||
| */ | ||
| function basePropertyDeep(path) { | ||
| return function(object) { | ||
| return baseGet(object, path); | ||
| }; | ||
| } | ||
| /** | ||
| * The base implementation of `_.some` without support for iteratee shorthands. | ||
| * | ||
| * @private | ||
| * @param {Array|Object} collection The collection to iterate over. | ||
| * @param {Function} predicate The function invoked per iteration. | ||
| * @returns {boolean} Returns `true` if any element passes the predicate check, | ||
| * else `false`. | ||
| * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. | ||
| */ | ||
@@ -59,28 +224,120 @@ function baseSome(collection, predicate) { | ||
| /** | ||
| * Checks if `predicate` returns truthy for **any** element of `collection`. | ||
| * The function returns as soon as it finds a passing value and does not iterate | ||
| * over the entire collection. The predicate is bound to `thisArg` and invoked | ||
| * with three arguments: (value, index|key, collection). | ||
| * The base implementation of `_.toPath` which only converts `value` to a | ||
| * path if it's not one. | ||
| * | ||
| * If a property name is provided for `predicate` the created `_.property` | ||
| * style callback returns the property value of the given element. | ||
| * @private | ||
| * @param {*} value The value to process. | ||
| * @returns {Array} Returns the property path array. | ||
| */ | ||
| function baseToPath(value) { | ||
| return isArray(value) ? value : stringToPath(value); | ||
| } | ||
| /** | ||
| * Gets the "length" property value of `object`. | ||
| * | ||
| * If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
| * style callback returns `true` for elements that have a matching property | ||
| * value, else `false`. | ||
| * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) | ||
| * that affects Safari on at least iOS 8.1-8.3 ARM64. | ||
| * | ||
| * If an object is provided for `predicate` the created `_.matches` style | ||
| * callback returns `true` for elements that have the properties of the given | ||
| * object, else `false`. | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @returns {*} Returns the "length" value. | ||
| */ | ||
| var getLength = baseProperty('length'); | ||
| /** | ||
| * Gets the property names, values, and compare flags of `object`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @returns {Array} Returns the match data of `object`. | ||
| */ | ||
| function getMatchData(object) { | ||
| var result = toPairs(object), | ||
| length = result.length; | ||
| while (length--) { | ||
| result[length][2] = isStrictComparable(result[length][1]); | ||
| } | ||
| return result; | ||
| } | ||
| /** | ||
| * Checks if the provided arguments are from an iteratee call. | ||
| * | ||
| * @private | ||
| * @param {*} value The potential iteratee value argument. | ||
| * @param {*} index The potential iteratee index or key argument. | ||
| * @param {*} object The potential iteratee object argument. | ||
| * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. | ||
| */ | ||
| function isIterateeCall(value, index, object) { | ||
| if (!isObject(object)) { | ||
| return false; | ||
| } | ||
| var type = typeof index; | ||
| if (type == 'number' | ||
| ? (isArrayLike(object) && isIndex(index, object.length)) | ||
| : (type == 'string' && index in object)) { | ||
| return eq(object[index], value); | ||
| } | ||
| return false; | ||
| } | ||
| /** | ||
| * Checks if `value` is a property name and not a property path. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to check. | ||
| * @param {Object} [object] The object to query keys on. | ||
| * @returns {boolean} Returns `true` if `value` is a property name, else `false`. | ||
| */ | ||
| function isKey(value, object) { | ||
| if (typeof value == 'number') { | ||
| return true; | ||
| } | ||
| return !isArray(value) && | ||
| (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || | ||
| (object != null && value in Object(object))); | ||
| } | ||
| /** | ||
| * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` if suitable for strict | ||
| * equality comparisons, else `false`. | ||
| */ | ||
| function isStrictComparable(value) { | ||
| return value === value && !isObject(value); | ||
| } | ||
| /** | ||
| * Converts `string` to a property path array. | ||
| * | ||
| * @private | ||
| * @param {string} string The string to convert. | ||
| * @returns {Array} Returns the property path array. | ||
| */ | ||
| function stringToPath(string) { | ||
| var result = []; | ||
| toString(string).replace(rePropName, function(match, number, quote, string) { | ||
| result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); | ||
| }); | ||
| return result; | ||
| } | ||
| /** | ||
| * Checks if `predicate` returns truthy for **any** element of `collection`. | ||
| * Iteration is stopped once `predicate` returns truthy. The predicate is | ||
| * invoked with three arguments: (value, index|key, collection). | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @alias any | ||
| * @category Collection | ||
| * @param {Array|Object|string} collection The collection to iterate over. | ||
| * @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
| * per iteration. | ||
| * @param {*} [thisArg] The `this` binding of `predicate`. | ||
| * @returns {boolean} Returns `true` if any element passes the predicate check, | ||
| * else `false`. | ||
| * @param {Array|Object} collection The collection to iterate over. | ||
| * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration. | ||
| * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. | ||
| * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. | ||
| * @example | ||
@@ -96,25 +353,320 @@ * | ||
| * | ||
| * // using the `_.matches` callback shorthand | ||
| * // using the `_.matches` iteratee shorthand | ||
| * _.some(users, { 'user': 'barney', 'active': false }); | ||
| * // => false | ||
| * | ||
| * // using the `_.matchesProperty` callback shorthand | ||
| * _.some(users, 'active', false); | ||
| * // using the `_.matchesProperty` iteratee shorthand | ||
| * _.some(users, ['active', false]); | ||
| * // => true | ||
| * | ||
| * // using the `_.property` callback shorthand | ||
| * // using the `_.property` iteratee shorthand | ||
| * _.some(users, 'active'); | ||
| * // => true | ||
| */ | ||
| function some(collection, predicate, thisArg) { | ||
| function some(collection, predicate, guard) { | ||
| var func = isArray(collection) ? arraySome : baseSome; | ||
| if (thisArg && isIterateeCall(collection, predicate, thisArg)) { | ||
| if (guard && isIterateeCall(collection, predicate, guard)) { | ||
| predicate = undefined; | ||
| } | ||
| if (typeof predicate != 'function' || thisArg !== undefined) { | ||
| predicate = baseCallback(predicate, thisArg, 3); | ||
| return func(collection, baseIteratee(predicate, 3)); | ||
| } | ||
| /** | ||
| * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
| * comparison between two values to determine if they are equivalent. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Lang | ||
| * @param {*} value The value to compare. | ||
| * @param {*} other The other value to compare. | ||
| * @returns {boolean} Returns `true` if the values are equivalent, else `false`. | ||
| * @example | ||
| * | ||
| * var object = { 'user': 'fred' }; | ||
| * var other = { 'user': 'fred' }; | ||
| * | ||
| * _.eq(object, object); | ||
| * // => true | ||
| * | ||
| * _.eq(object, other); | ||
| * // => false | ||
| * | ||
| * _.eq('a', 'a'); | ||
| * // => true | ||
| * | ||
| * _.eq('a', Object('a')); | ||
| * // => false | ||
| * | ||
| * _.eq(NaN, NaN); | ||
| * // => true | ||
| */ | ||
| function eq(value, other) { | ||
| return value === other || (value !== value && other !== other); | ||
| } | ||
| /** | ||
| * Checks if `value` is classified as an `Array` object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @type Function | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
| * @example | ||
| * | ||
| * _.isArray([1, 2, 3]); | ||
| * // => true | ||
| * | ||
| * _.isArray(document.body.children); | ||
| * // => false | ||
| * | ||
| * _.isArray('abc'); | ||
| * // => false | ||
| * | ||
| * _.isArray(_.noop); | ||
| * // => false | ||
| */ | ||
| var isArray = Array.isArray; | ||
| /** | ||
| * Checks if `value` is array-like. A value is considered array-like if it's | ||
| * not a function and has a `value.length` that's an integer greater than or | ||
| * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @type Function | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is array-like, else `false`. | ||
| * @example | ||
| * | ||
| * _.isArrayLike([1, 2, 3]); | ||
| * // => true | ||
| * | ||
| * _.isArrayLike(document.body.children); | ||
| * // => true | ||
| * | ||
| * _.isArrayLike('abc'); | ||
| * // => true | ||
| * | ||
| * _.isArrayLike(_.noop); | ||
| * // => false | ||
| */ | ||
| function isArrayLike(value) { | ||
| return value != null && | ||
| !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); | ||
| } | ||
| /** | ||
| * Checks if `value` is classified as a `Function` object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
| * @example | ||
| * | ||
| * _.isFunction(_); | ||
| * // => true | ||
| * | ||
| * _.isFunction(/abc/); | ||
| * // => false | ||
| */ | ||
| 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. | ||
| var tag = isObject(value) ? objectToString.call(value) : ''; | ||
| return tag == funcTag || tag == genTag; | ||
| } | ||
| /** | ||
| * Checks if `value` is a valid array-like length. | ||
| * | ||
| * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
| * @example | ||
| * | ||
| * _.isLength(3); | ||
| * // => true | ||
| * | ||
| * _.isLength(Number.MIN_VALUE); | ||
| * // => false | ||
| * | ||
| * _.isLength(Infinity); | ||
| * // => false | ||
| * | ||
| * _.isLength('3'); | ||
| * // => false | ||
| */ | ||
| function isLength(value) { | ||
| return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
| } | ||
| /** | ||
| * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
| * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
| * @example | ||
| * | ||
| * _.isObject({}); | ||
| * // => true | ||
| * | ||
| * _.isObject([1, 2, 3]); | ||
| * // => true | ||
| * | ||
| * _.isObject(_.noop); | ||
| * // => true | ||
| * | ||
| * _.isObject(null); | ||
| * // => false | ||
| */ | ||
| function isObject(value) { | ||
| // Avoid a V8 JIT bug in Chrome 19-20. | ||
| // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. | ||
| var type = typeof value; | ||
| return !!value && (type == 'object' || type == 'function'); | ||
| } | ||
| /** | ||
| * Checks if `value` is object-like. A value is object-like if it's not `null` | ||
| * and has a `typeof` result of "object". | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
| * @example | ||
| * | ||
| * _.isObjectLike({}); | ||
| * // => true | ||
| * | ||
| * _.isObjectLike([1, 2, 3]); | ||
| * // => true | ||
| * | ||
| * _.isObjectLike(_.noop); | ||
| * // => false | ||
| * | ||
| * _.isObjectLike(null); | ||
| * // => false | ||
| */ | ||
| function isObjectLike(value) { | ||
| return !!value && typeof value == 'object'; | ||
| } | ||
| /** | ||
| * Checks if `value` is classified as a `Symbol` primitive or object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. | ||
| * @example | ||
| * | ||
| * _.isSymbol(Symbol.iterator); | ||
| * // => true | ||
| * | ||
| * _.isSymbol('abc'); | ||
| * // => false | ||
| */ | ||
| function isSymbol(value) { | ||
| return typeof value == 'symbol' || | ||
| (isObjectLike(value) && objectToString.call(value) == symbolTag); | ||
| } | ||
| /** | ||
| * Converts `value` to a string if it's not one. An empty string is returned | ||
| * for `null` and `undefined` values. The sign of `-0` is preserved. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Lang | ||
| * @param {*} value The value to process. | ||
| * @returns {string} Returns the string. | ||
| * @example | ||
| * | ||
| * _.toString(null); | ||
| * // => '' | ||
| * | ||
| * _.toString(-0); | ||
| * // => '-0' | ||
| * | ||
| * _.toString([1, 2, 3]); | ||
| * // => '1,2,3' | ||
| */ | ||
| function toString(value) { | ||
| // Exit early for strings to avoid a performance hit in some environments. | ||
| if (typeof value == 'string') { | ||
| return value; | ||
| } | ||
| return func(collection, predicate); | ||
| if (value == null) { | ||
| return ''; | ||
| } | ||
| if (isSymbol(value)) { | ||
| return _Symbol ? symbolToString.call(value) : ''; | ||
| } | ||
| var result = (value + ''); | ||
| return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | ||
| } | ||
| /** | ||
| * This method returns the first argument provided to it. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Util | ||
| * @param {*} value Any value. | ||
| * @returns {*} Returns `value`. | ||
| * @example | ||
| * | ||
| * var object = { 'user': 'fred' }; | ||
| * | ||
| * _.identity(object) === object; | ||
| * // => true | ||
| */ | ||
| function identity(value) { | ||
| return value; | ||
| } | ||
| /** | ||
| * Creates a function that returns the value at `path` of a given object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @category Util | ||
| * @param {Array|string} path The path of the property to get. | ||
| * @returns {Function} Returns the new function. | ||
| * @example | ||
| * | ||
| * var objects = [ | ||
| * { 'a': { 'b': { 'c': 2 } } }, | ||
| * { 'a': { 'b': { 'c': 1 } } } | ||
| * ]; | ||
| * | ||
| * _.map(objects, _.property('a.b.c')); | ||
| * // => [2, 1] | ||
| * | ||
| * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); | ||
| * // => [1, 2] | ||
| */ | ||
| function property(path) { | ||
| return isKey(path) ? baseProperty(path) : basePropertyDeep(path); | ||
| } | ||
| module.exports = some; |
+2
-2
@@ -1,3 +0,3 @@ | ||
| Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
| Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, | ||
| Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
| Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, | ||
| DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
@@ -4,0 +4,0 @@ |
+10
-11
| { | ||
| "name": "lodash.some", | ||
| "version": "3.2.3", | ||
| "description": "The modern build of lodash’s `_.some` as a module.", | ||
| "version": "4.0.0", | ||
| "description": "The lodash method `_.some` exported as a module.", | ||
| "homepage": "https://lodash.com/", | ||
| "icon": "https://lodash.com/icon.svg", | ||
| "license": "MIT", | ||
| "keywords": "lodash, lodash-modularized, stdlib, util", | ||
| "keywords": "lodash, lodash-modularized, stdlib, util, some", | ||
| "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
| "contributors": [ | ||
| "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
| "Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)", | ||
| "Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)", | ||
| "Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)", | ||
| "Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)", | ||
| "Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -20,8 +18,9 @@ ], | ||
| "dependencies": { | ||
| "lodash._basecallback": "^3.0.0", | ||
| "lodash._baseeach": "^3.0.0", | ||
| "lodash._isiterateecall": "^3.0.0", | ||
| "lodash.isarray": "^3.0.0", | ||
| "lodash.keys": "^3.0.0" | ||
| "lodash._baseeach": "^4.0.0", | ||
| "lodash._baseisequal": "^4.0.0", | ||
| "lodash._baseismatch": "^4.0.0", | ||
| "lodash.get": "^4.0.0", | ||
| "lodash.hasin": "^4.0.0", | ||
| "lodash.topairs": "^4.0.0" | ||
| } | ||
| } |
+4
-6
@@ -1,4 +0,4 @@ | ||
| # lodash.some v3.2.3 | ||
| # lodash.some v4.0.0 | ||
| The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.some` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
| The [lodash](https://lodash.com/) method `_.some` exported as a [Node.js](https://nodejs.org/) module. | ||
@@ -8,3 +8,2 @@ ## Installation | ||
| Using npm: | ||
| ```bash | ||
@@ -15,4 +14,3 @@ $ {sudo -H} npm i -g npm | ||
| In Node.js/io.js: | ||
| In Node.js: | ||
| ```js | ||
@@ -22,2 +20,2 @@ var some = require('lodash.some'); | ||
| See the [documentation](https://lodash.com/docs#some) or [package source](https://github.com/lodash/lodash/blob/3.2.3-npm-packages/lodash.some) for more details. | ||
| See the [documentation](https://lodash.com/docs#some) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.some) for more details. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
20422
204.35%623
466.36%6
20%19
-9.52%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated