lodash.flattendeep
Advanced tools
+348
-3
| /** | ||
| * lodash 4.2.0 (Custom Build) <https://lodash.com/> | ||
| * lodash (Custom Build) <https://lodash.com/> | ||
| * Build: `lodash modularize exports="npm" -o ./` | ||
@@ -9,8 +9,131 @@ * Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
| */ | ||
| var baseFlatten = require('lodash._baseflatten'); | ||
| /** Used as references for various `Number` constants. */ | ||
| var INFINITY = 1 / 0; | ||
| var INFINITY = 1 / 0, | ||
| MAX_SAFE_INTEGER = 9007199254740991; | ||
| /** `Object#toString` result references. */ | ||
| var argsTag = '[object Arguments]', | ||
| funcTag = '[object Function]', | ||
| genTag = '[object GeneratorFunction]'; | ||
| /** Detect free variable `global` from Node.js. */ | ||
| var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; | ||
| /** Detect free variable `self`. */ | ||
| var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | ||
| /** Used as a reference to the global object. */ | ||
| var root = freeGlobal || freeSelf || Function('return this')(); | ||
| /** | ||
| * Appends the elements of `values` to `array`. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to modify. | ||
| * @param {Array} values The values to append. | ||
| * @returns {Array} Returns `array`. | ||
| */ | ||
| function arrayPush(array, values) { | ||
| var index = -1, | ||
| length = values.length, | ||
| offset = array.length; | ||
| while (++index < length) { | ||
| array[offset + index] = values[index]; | ||
| } | ||
| return array; | ||
| } | ||
| /** | ||
| * 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 accessor function. | ||
| */ | ||
| function baseProperty(key) { | ||
| return function(object) { | ||
| return object == null ? undefined : object[key]; | ||
| }; | ||
| } | ||
| /** Used for built-in method references. */ | ||
| var objectProto = Object.prototype; | ||
| /** Used to check objects for own properties. */ | ||
| var hasOwnProperty = objectProto.hasOwnProperty; | ||
| /** | ||
| * 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 = root.Symbol, | ||
| propertyIsEnumerable = objectProto.propertyIsEnumerable, | ||
| spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; | ||
| /** | ||
| * The base implementation of `_.flatten` with support for restricting flattening. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to flatten. | ||
| * @param {number} depth The maximum recursion depth. | ||
| * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. | ||
| * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. | ||
| * @param {Array} [result=[]] The initial result value. | ||
| * @returns {Array} Returns the new flattened array. | ||
| */ | ||
| function baseFlatten(array, depth, predicate, isStrict, result) { | ||
| var index = -1, | ||
| length = array.length; | ||
| predicate || (predicate = isFlattenable); | ||
| result || (result = []); | ||
| while (++index < length) { | ||
| var value = array[index]; | ||
| if (depth > 0 && predicate(value)) { | ||
| if (depth > 1) { | ||
| // Recursively flatten arrays (susceptible to call stack limits). | ||
| baseFlatten(value, depth - 1, predicate, isStrict, result); | ||
| } else { | ||
| arrayPush(result, value); | ||
| } | ||
| } else if (!isStrict) { | ||
| result[result.length] = value; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
| /** | ||
| * Gets the "length" property value of `object`. | ||
| * | ||
| * **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. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @returns {*} Returns the "length" value. | ||
| */ | ||
| var getLength = baseProperty('length'); | ||
| /** | ||
| * Checks if `value` is a flattenable `arguments` object or array. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. | ||
| */ | ||
| function isFlattenable(value) { | ||
| return isArray(value) || isArguments(value) || | ||
| !!(spreadableSymbol && value && value[spreadableSymbol]) | ||
| } | ||
| /** | ||
| * Recursively flattens `array`. | ||
@@ -34,2 +157,224 @@ * | ||
| /** | ||
| * Checks if `value` is likely an `arguments` object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @since 0.1.0 | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is an `arguments` object, | ||
| * else `false`. | ||
| * @example | ||
| * | ||
| * _.isArguments(function() { return arguments; }()); | ||
| * // => true | ||
| * | ||
| * _.isArguments([1, 2, 3]); | ||
| * // => false | ||
| */ | ||
| function isArguments(value) { | ||
| // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. | ||
| return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && | ||
| (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); | ||
| } | ||
| /** | ||
| * Checks if `value` is classified as an `Array` object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @since 0.1.0 | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is an array, 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 _ | ||
| * @since 4.0.0 | ||
| * @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 && isLength(getLength(value)) && !isFunction(value); | ||
| } | ||
| /** | ||
| * This method is like `_.isArrayLike` except that it also checks if `value` | ||
| * is an object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @since 4.0.0 | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is an array-like object, | ||
| * else `false`. | ||
| * @example | ||
| * | ||
| * _.isArrayLikeObject([1, 2, 3]); | ||
| * // => true | ||
| * | ||
| * _.isArrayLikeObject(document.body.children); | ||
| * // => true | ||
| * | ||
| * _.isArrayLikeObject('abc'); | ||
| * // => false | ||
| * | ||
| * _.isArrayLikeObject(_.noop); | ||
| * // => false | ||
| */ | ||
| function isArrayLikeObject(value) { | ||
| return isObjectLike(value) && isArrayLike(value); | ||
| } | ||
| /** | ||
| * Checks if `value` is classified as a `Function` object. | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @since 0.1.0 | ||
| * @category Lang | ||
| * @param {*} value The value to check. | ||
| * @returns {boolean} Returns `true` if `value` is a function, 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 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; | ||
| } | ||
| /** | ||
| * 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 _ | ||
| * @since 4.0.0 | ||
| * @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](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) | ||
| * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
| * | ||
| * @static | ||
| * @memberOf _ | ||
| * @since 0.1.0 | ||
| * @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) { | ||
| 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 _ | ||
| * @since 4.0.0 | ||
| * @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'; | ||
| } | ||
| module.exports = flattenDeep; |
+2
-5
| { | ||
| "name": "lodash.flattendeep", | ||
| "version": "4.2.0", | ||
| "version": "4.3.0", | ||
| "description": "The lodash method `_.flattenDeep` exported as a module.", | ||
@@ -16,6 +16,3 @@ "homepage": "https://lodash.com/", | ||
| "repository": "lodash/lodash", | ||
| "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, | ||
| "dependencies": { | ||
| "lodash._baseflatten": "~4.2.0" | ||
| } | ||
| "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } | ||
| } |
+2
-2
@@ -1,2 +0,2 @@ | ||
| # lodash.flattendeep v4.2.0 | ||
| # lodash.flattendeep v4.3.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.flattenDeep` exported as a [Node.js](https://nodejs.org/) module. | ||
| See the [documentation](https://lodash.com/docs#flattenDeep) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.flattendeep) for more details. | ||
| See the [documentation](https://lodash.com/docs#flattenDeep) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.flattendeep) 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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
12915
205.61%0
-100%351
1070%3
50%2
Infinity%- Removed
- Removed