+7
-7
| { | ||
| "name": "pluck-util", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "Extract a list of property values from a collection.", | ||
@@ -37,12 +37,12 @@ "main": "index.js", | ||
| "devDependencies": { | ||
| "@rollup/plugin-commonjs": "^11.0.2", | ||
| "@rollup/plugin-node-resolve": "^7.1.1", | ||
| "@rollup/plugin-commonjs": "^16.0.0", | ||
| "@rollup/plugin-node-resolve": "^10.0.0", | ||
| "babel-eslint": "^10.1.0", | ||
| "eslint": "^6.8.0", | ||
| "mocha": "^7.1.1", | ||
| "rollup": "^2.2.0" | ||
| "eslint": "^7.13.0", | ||
| "mocha": "^8.2.1", | ||
| "rollup": "^2.33.1" | ||
| }, | ||
| "dependencies": { | ||
| "@jonkemp/package-utils": "^1.0.3" | ||
| "@jonkemp/package-utils": "^1.0.7" | ||
| } | ||
| } |
+68
-227
| (function (global, factory) { | ||
| typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
| typeof define === 'function' && define.amd ? define(factory) : | ||
| (global = global || self, global.pluck = factory()); | ||
| (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.pluck = factory()); | ||
| }(this, (function () { 'use strict'; | ||
| const shallowProperty = key => obj => obj == null ? void 0 : obj[key]; | ||
| var shallowProperty = key => obj => obj == null ? void 0 : obj[key]; | ||
| const MAX_ARRAY_INDEX = 2 ** 53 - 1; | ||
| var getLength = shallowProperty('length'); | ||
| const getLength = shallowProperty('length'); | ||
| const isArrayLike = (collection) => { | ||
| var isArrayLike = (collection) => { | ||
| const length = getLength(collection); | ||
| return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; | ||
| return typeof length == 'number' && length >= 0 && length <= Number.MAX_SAFE_INTEGER; | ||
| }; | ||
| const isFunction = obj => toString.call(obj) === '[object Function]'; | ||
| var isFunction = obj => toString.call(obj) === '[object Function]'; | ||
| const isObject = obj => { | ||
| var isObject = obj => { | ||
| const type = typeof obj; | ||
@@ -27,7 +25,7 @@ | ||
| const isArguments = obj => toString.call(obj) === '[object Arguments]'; | ||
| var isArguments = obj => toString.call(obj) === '[object Arguments]'; | ||
| const identity = value => value; | ||
| var identity = value => value; | ||
| const getKeys = (obj) => { | ||
| var getKeys = (obj) => { | ||
| if (!isObject(obj)) return []; | ||
@@ -38,3 +36,22 @@ | ||
| const isMatch = (object, attrs) => { | ||
| const deepGet = (obj, path) => { | ||
| const { length } = path; | ||
| for (let i = 0; i < length; i++) { | ||
| if (obj == null) return void 0; | ||
| obj = obj[path[i]]; | ||
| } | ||
| return length ? obj : void 0; | ||
| }; | ||
| var property = path => { | ||
| if (!Array.isArray(path)) { | ||
| return shallowProperty(path); | ||
| } | ||
| return obj => deepGet(obj, path); | ||
| }; | ||
| var isMatch = (object, attrs) => { | ||
| const keys = getKeys(attrs); | ||
@@ -55,3 +72,3 @@ const {length} = keys; | ||
| const matcher = attrs => { | ||
| var matcher = attrs => { | ||
| attrs = Object.assign({}, attrs); | ||
@@ -62,22 +79,3 @@ | ||
| const deepGet = (obj, path) => { | ||
| const { length } = path; | ||
| for (let i = 0; i < length; i++) { | ||
| if (obj == null) return void 0; | ||
| obj = obj[path[i]]; | ||
| } | ||
| return length ? obj : void 0; | ||
| }; | ||
| const property = path => { | ||
| if (!Array.isArray(path)) { | ||
| return shallowProperty(path); | ||
| } | ||
| return obj => deepGet(obj, path); | ||
| }; | ||
| const optimizeCb = (func, context, argCount) => { | ||
| var optimizeCb = (func, context, argCount) => { | ||
| if (context === void 0) return func; | ||
@@ -106,3 +104,3 @@ switch (argCount == null ? 3 : argCount) { | ||
| const cb = (value, context, argCount) => { | ||
| var cb = (value, context, argCount) => { | ||
| if (iteratee !== exportIteratee) return iteratee(value, context); | ||
@@ -113,23 +111,5 @@ | ||
| var lib = { | ||
| shallowProperty, | ||
| getLength, | ||
| isArrayLike, | ||
| isFunction, | ||
| isObject, | ||
| isArguments, | ||
| identity, | ||
| getKeys, | ||
| property, | ||
| matcher, | ||
| isMatch, | ||
| optimizeCb, | ||
| cb | ||
| }; | ||
| const { getKeys: getKeys$1, isArrayLike: isArrayLike$1, optimizeCb: optimizeCb$1 } = lib; | ||
| var forEach = (obj, iteratee, context) => { | ||
| iteratee = optimizeCb$1(iteratee, context); | ||
| if (isArrayLike$1(obj)) { | ||
| iteratee = optimizeCb(iteratee, context); | ||
| if (isArrayLike(obj)) { | ||
| let i = 0; | ||
@@ -141,3 +121,3 @@ | ||
| } else { | ||
| const keys = getKeys$1(obj); | ||
| const keys = getKeys(obj); | ||
@@ -152,4 +132,2 @@ for (const key of keys) { | ||
| const { isArrayLike: isArrayLike$2, isArguments: isArguments$1 } = lib; | ||
| const flatten = (input, shallow, strict, output = []) => { | ||
@@ -159,3 +137,3 @@ let idx = output.length; | ||
| forEach(input, value => { | ||
| if (isArrayLike$2(value) && (Array.isArray(value) || isArguments$1(value))) { | ||
| if (isArrayLike(value) && (Array.isArray(value) || isArguments(value))) { | ||
| if (shallow) { | ||
@@ -180,7 +158,5 @@ let j = 0; | ||
| const { getKeys: getKeys$2, isArrayLike: isArrayLike$3, cb: cb$1 } = lib; | ||
| var map = (obj, iteratee, context) => { | ||
| iteratee = cb$1(iteratee, context); | ||
| const keys = !isArrayLike$3(obj) && getKeys$2(obj); | ||
| iteratee = cb(iteratee, context); | ||
| const keys = !isArrayLike(obj) && getKeys(obj); | ||
| const { length } = keys || obj; | ||
@@ -198,46 +174,39 @@ const results = Array(length); | ||
| var lib = { | ||
| shallowProperty, | ||
| getLength, | ||
| isArrayLike, | ||
| isFunction, | ||
| isObject, | ||
| isArguments, | ||
| identity, | ||
| getKeys, | ||
| property, | ||
| matcher, | ||
| isMatch, | ||
| optimizeCb, | ||
| cb, | ||
| forEach, | ||
| map, | ||
| flatten: flatten_1 | ||
| }; | ||
| const { | ||
| getLength: getLength$1, | ||
| isArrayLike: isArrayLike$4, | ||
| isFunction: isFunction$1, | ||
| isObject: isObject$1, | ||
| isArguments: isArguments$2, | ||
| identity: identity$1, | ||
| getKeys: getKeys$3, | ||
| property: property$1, | ||
| matcher: matcher$1, | ||
| isMatch: isMatch$1, | ||
| optimizeCb: optimizeCb$2, | ||
| cb: cb$2 | ||
| optimizeCb: optimizeCb$1, | ||
| cb: cb$1, | ||
| forEach: forEach$1, | ||
| map: map$1, | ||
| flatten: flatten$1 | ||
| } = lib; | ||
| const isNumber = obj => toString.call(obj) === '[object Number]'; | ||
| const isString = obj => toString.call(obj) === '[object String]'; | ||
| const isUndefined = obj => obj === void 0; | ||
| const has = (obj, path) => obj != null && Object.prototype.hasOwnProperty.call(obj, path); | ||
| const hasProperty = (obj, path) => { | ||
| if (!Array.isArray(path)) { | ||
| return has(obj, path); | ||
| } | ||
| const { length } = path; | ||
| for (let i = 0; i < length; i++) { | ||
| const key = path[i]; | ||
| if (obj == null || !Object.prototype.hasOwnProperty.call(obj, key)) { | ||
| return false; | ||
| } | ||
| obj = obj[key]; | ||
| } | ||
| return !!length; | ||
| }; | ||
| const constant = value => () => value; | ||
@@ -256,128 +225,10 @@ | ||
| const values = (obj) => { | ||
| const keys = getKeys$3(obj); | ||
| const { length } = keys; | ||
| const values = Array(length); | ||
| for (let i = 0; i < length; i++) { | ||
| values[i] = obj[keys[i]]; | ||
| } | ||
| return values; | ||
| }; | ||
| const toPairs = (obj) => { | ||
| const keys = getKeys$3(obj); | ||
| const pairs = []; | ||
| for (const key of keys) { | ||
| pairs.push([key, obj[key]]); | ||
| } | ||
| return pairs; | ||
| }; | ||
| const noop = () => {}; | ||
| const initial = (array, n, guard) => Array.prototype.slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); | ||
| const createPredicateIndexFinder = dir => (array, predicate, context) => { | ||
| predicate = cb$2(predicate, context); | ||
| const length = getLength$1(array); | ||
| let index = dir > 0 ? 0 : length - 1; | ||
| for (; index >= 0 && index < length; index += dir) { | ||
| if (predicate(array[index], index, array)) return index; | ||
| } | ||
| return -1; | ||
| }; | ||
| const findIndex = createPredicateIndexFinder(1); | ||
| const range = (start, stop, step) => { | ||
| if (stop == null) { | ||
| stop = start || 0; | ||
| start = 0; | ||
| } | ||
| if (!step) { | ||
| step = stop < start ? -1 : 1; | ||
| } | ||
| const length = Math.max(Math.ceil((stop - start) / step), 0); | ||
| const range = Array(length); | ||
| for (let idx = 0; idx < length; idx++, start += step) { | ||
| range[idx] = start; | ||
| } | ||
| return range; | ||
| }; | ||
| const findKey = (obj, predicate, context) => { | ||
| predicate = cb$2(predicate, context); | ||
| const keys = getKeys$3(obj); | ||
| let key; | ||
| for (let i = 0, { length } = keys; i < length; i++) { | ||
| key = keys[i]; | ||
| if (predicate(obj[key], key, obj)) return key; | ||
| } | ||
| }; | ||
| const find = (obj, predicate, context) => { | ||
| const keyFinder = isArrayLike$4(obj) ? findIndex : findKey; | ||
| const key = keyFinder(obj, predicate, context); | ||
| if (key !== void 0 && key !== -1) return obj[key]; | ||
| }; | ||
| const filter = (obj, predicate, context) => { | ||
| const results = []; | ||
| predicate = cb$2(predicate, context); | ||
| forEach(obj, (value, index, list) => { | ||
| if (predicate(value, index, list)) results.push(value); | ||
| }); | ||
| return results; | ||
| }; | ||
| const reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; | ||
| const toArray = (obj) => { | ||
| if (!obj) return []; | ||
| if (Array.isArray(obj)) return Array.prototype.slice.call(obj); | ||
| if (isString(obj)) { | ||
| // Keep surrogate pair characters together | ||
| return obj.match(reStrSymbol); | ||
| } | ||
| if (isArrayLike$4(obj)) return map(identity$1); | ||
| return values(obj); | ||
| }; | ||
| const first = (array, n, guard) => { | ||
| if (array == null || array.length < 1) return n == null ? void 0 : []; | ||
| if (n == null || guard) return array[0]; | ||
| return initial(array, array.length - n); | ||
| }; | ||
| var packageUtils = { | ||
| getLength: getLength$1, | ||
| isArrayLike: isArrayLike$4, | ||
| optimizeCb: optimizeCb$2, | ||
| optimizeCb: optimizeCb$1, | ||
| isFunction: isFunction$1, | ||
| isNumber, | ||
| isArguments: isArguments$2, | ||
| isString, | ||
| isUndefined, | ||
| isObject: isObject$1, | ||
| getKeys: getKeys$3, | ||
| hasProperty, | ||
| property: property$1, | ||
| isMatch: isMatch$1, | ||
| matcher: matcher$1, | ||
| findKey, | ||
| identity: identity$1, | ||
@@ -387,16 +238,6 @@ constant, | ||
| allKeys, | ||
| values, | ||
| toPairs, | ||
| cb: cb$2, | ||
| noop, | ||
| forEach, | ||
| map, | ||
| find, | ||
| filter, | ||
| toArray, | ||
| first, | ||
| initial, | ||
| flatten: flatten_1, | ||
| findIndex, | ||
| range | ||
| cb: cb$1, | ||
| forEach: forEach$1, | ||
| map: map$1, | ||
| flatten: flatten$1 | ||
| }; | ||
@@ -403,0 +244,0 @@ |
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.
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.
9204
-28.15%182
-39.33%