lodash.takerightwhile
Advanced tools
+3
-302
| /** | ||
| * lodash 4.1.1 (Custom Build) <https://lodash.com/> | ||
| * lodash 4.2.0 (Custom Build) <https://lodash.com/> | ||
| * Build: `lodash modularize exports="npm" -o ./` | ||
@@ -9,147 +9,6 @@ * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
| */ | ||
| var baseIsEqual = require('lodash._baseisequal'), | ||
| baseIsMatch = require('lodash._baseismatch'), | ||
| baseSlice = require('lodash._baseslice'), | ||
| get = require('lodash.get'), | ||
| hasIn = require('lodash.hasin'), | ||
| toPairs = require('lodash.topairs'), | ||
| toString = require('lodash.tostring'); | ||
| var baseIteratee = require('lodash._baseiteratee'), | ||
| baseSlice = require('lodash._baseslice'); | ||
| /** Used to compose bitmasks for comparison styles. */ | ||
| var UNORDERED_COMPARE_FLAG = 1, | ||
| PARTIAL_COMPARE_FLAG = 2; | ||
| /** 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; | ||
| /** | ||
| * 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 `_.toPath` which only converts `value` to a | ||
| * path if it's not one. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to process. | ||
| * @returns {Array} Returns the property path array. | ||
| */ | ||
| function baseToPath(value) { | ||
| return isArray(value) ? value : stringToPath(value); | ||
| } | ||
| /** | ||
| * The base implementation of methods like `_.dropWhile` and `_.takeWhile` | ||
@@ -178,63 +37,2 @@ * without support for iteratee shorthands. | ||
| /** | ||
| * 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 `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; | ||
| } | ||
| /** | ||
| * Creates a slice of `array` with elements taken from the end. Elements are | ||
@@ -279,99 +77,2 @@ * taken until `predicate` returns falsey. The predicate is invoked with three | ||
| /** | ||
| * 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 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) { | ||
| var type = typeof value; | ||
| return !!value && (type == 'object' || type == 'function'); | ||
| } | ||
| /** | ||
| * This method returns the first argument given 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 = takeRightWhile; |
+3
-8
| { | ||
| "name": "lodash.takerightwhile", | ||
| "version": "4.1.1", | ||
| "version": "4.2.0", | ||
| "description": "The lodash method `_.takeRightWhile` exported as a module.", | ||
@@ -18,10 +18,5 @@ "homepage": "https://lodash.com/", | ||
| "dependencies": { | ||
| "lodash._baseisequal": "^4.0.0", | ||
| "lodash._baseismatch": "^4.0.0", | ||
| "lodash._baseslice": "^4.0.0", | ||
| "lodash.get": "^4.0.0", | ||
| "lodash.hasin": "^4.0.0", | ||
| "lodash.topairs": "^4.0.0", | ||
| "lodash.tostring": "^4.0.0" | ||
| "lodash._baseiteratee": "^4.0.0", | ||
| "lodash._baseslice": "^4.0.0" | ||
| } | ||
| } |
+2
-2
@@ -1,2 +0,2 @@ | ||
| # lodash.takerightwhile v4.1.1 | ||
| # lodash.takerightwhile v4.2.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.takeRightWhile` exported as a [Node.js](https://nodejs.org/) module. | ||
| See the [documentation](https://lodash.com/docs#takeRightWhile) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.takerightwhile) for more details. | ||
| See the [documentation](https://lodash.com/docs#takeRightWhile) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.takerightwhile) 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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
2
-71.43%3
-25%5271
-59.39%70
-79.83%1
Infinity%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed