+32
-52
@@ -1,32 +0,42 @@ | ||
| const shallowProperty = key => obj => obj == null ? void 0 : obj[key]; | ||
| var isObject = obj => { | ||
| const type = typeof obj; | ||
| const MAX_ARRAY_INDEX = 2 ** 53 - 1; | ||
| return type === 'function' || type === 'object' && !!obj; | ||
| }; | ||
| const getLength = shallowProperty('length'); | ||
| var getKeys = (obj) => { | ||
| if (!isObject(obj)) return []; | ||
| const isArrayLike = (collection) => { | ||
| const length = getLength(collection); | ||
| return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; | ||
| return Object.keys(obj); | ||
| }; | ||
| const isFunction = obj => toString.call(obj) === '[object Function]'; | ||
| var shallowProperty = key => obj => obj == null ? void 0 : obj[key]; | ||
| const isObject = obj => { | ||
| const type = typeof obj; | ||
| var getLength = shallowProperty('length'); | ||
| return type === 'function' || type === 'object' && !!obj; | ||
| const MAX_ARRAY_INDEX = 2 ** 53 - 1; | ||
| var isArrayLike = (collection) => { | ||
| const length = getLength(collection); | ||
| return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; | ||
| }; | ||
| const isArguments = obj => toString.call(obj) === '[object Arguments]'; | ||
| var identity = value => value; | ||
| const identity = value => value; | ||
| var isFunction = obj => toString.call(obj) === '[object Function]'; | ||
| const getKeys = (obj) => { | ||
| if (!isObject(obj)) return []; | ||
| var optimizeCb = (func, context, argCount) => { | ||
| if (context === void 0) return func; | ||
| switch (argCount == null ? 3 : argCount) { | ||
| case 1: return value => func.call(context, value); | ||
| // The 2-argument case is omitted because we’re not using it. | ||
| case 3: return (value, index, collection) => func.call(context, value, index, collection); | ||
| case 4: return (accumulator, value, index, collection) => func.call(context, accumulator, value, index, collection); | ||
| } | ||
| return Object.keys(obj); | ||
| return (...args) => func.apply(context, args); | ||
| }; | ||
| const isMatch = (object, attrs) => { | ||
| var isMatch = (object, attrs) => { | ||
| const keys = getKeys(attrs); | ||
@@ -47,3 +57,3 @@ const {length} = keys; | ||
| const matcher = attrs => { | ||
| var matcher = attrs => { | ||
| attrs = Object.assign({}, attrs); | ||
@@ -65,3 +75,3 @@ | ||
| const property = path => { | ||
| var property = path => { | ||
| if (!Array.isArray(path)) { | ||
@@ -74,14 +84,2 @@ return shallowProperty(path); | ||
| const optimizeCb = (func, context, argCount) => { | ||
| if (context === void 0) return func; | ||
| switch (argCount == null ? 3 : argCount) { | ||
| case 1: return value => func.call(context, value); | ||
| // The 2-argument case is omitted because we’re not using it. | ||
| case 3: return (value, index, collection) => func.call(context, value, index, collection); | ||
| case 4: return (accumulator, value, index, collection) => func.call(context, accumulator, value, index, collection); | ||
| } | ||
| return (...args) => func.apply(context, args); | ||
| }; | ||
| const baseIteratee = (value, context, argCount) => { | ||
@@ -99,3 +97,3 @@ if (value == null) return identity; | ||
| const cb = (value, context, argCount) => { | ||
| var cb = (value, context, argCount) => { | ||
| if (iteratee !== exportIteratee) return iteratee(value, context); | ||
@@ -106,23 +104,5 @@ | ||
| var lib = { | ||
| shallowProperty, | ||
| getLength, | ||
| isArrayLike, | ||
| isFunction, | ||
| isObject, | ||
| isArguments, | ||
| identity, | ||
| getKeys, | ||
| property, | ||
| matcher, | ||
| isMatch, | ||
| optimizeCb, | ||
| cb | ||
| }; | ||
| const { getKeys: getKeys$1, isArrayLike: isArrayLike$1, cb: cb$1 } = lib; | ||
| var map = (obj, iteratee, context) => { | ||
| iteratee = cb$1(iteratee, context); | ||
| const keys = !isArrayLike$1(obj) && getKeys$1(obj); | ||
| iteratee = cb(iteratee, context); | ||
| const keys = !isArrayLike(obj) && getKeys(obj); | ||
| const { length } = keys || obj; | ||
@@ -129,0 +109,0 @@ const results = Array(length); |
+2
-2
| { | ||
| "name": "map-plus", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Creates a new array of values by mapping each value in list through an iteratee.", | ||
@@ -46,4 +46,4 @@ "main": "index.js", | ||
| "mocha": "^7.1.1", | ||
| "rollup": "^2.1.0" | ||
| "rollup": "^2.3.0" | ||
| } | ||
| } |
+1
-1
@@ -21,3 +21,3 @@ # map-plus [](https://travis-ci.com/jonkemp/map-plus) | ||
| ``` | ||
| <script src="https://unpkg.com/map-plus@1.0.1/umd/index.js" /> | ||
| <script src="https://unpkg.com/map-plus@1.0.2/umd/index.js" /> | ||
| ``` | ||
@@ -24,0 +24,0 @@ |
+32
-52
@@ -7,33 +7,43 @@ (function (global, factory) { | ||
| const shallowProperty = key => obj => obj == null ? void 0 : obj[key]; | ||
| var isObject = obj => { | ||
| const type = typeof obj; | ||
| const MAX_ARRAY_INDEX = 2 ** 53 - 1; | ||
| return type === 'function' || type === 'object' && !!obj; | ||
| }; | ||
| const getLength = shallowProperty('length'); | ||
| var getKeys = (obj) => { | ||
| if (!isObject(obj)) return []; | ||
| const isArrayLike = (collection) => { | ||
| const length = getLength(collection); | ||
| return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; | ||
| return Object.keys(obj); | ||
| }; | ||
| const isFunction = obj => toString.call(obj) === '[object Function]'; | ||
| var shallowProperty = key => obj => obj == null ? void 0 : obj[key]; | ||
| const isObject = obj => { | ||
| const type = typeof obj; | ||
| var getLength = shallowProperty('length'); | ||
| return type === 'function' || type === 'object' && !!obj; | ||
| const MAX_ARRAY_INDEX = 2 ** 53 - 1; | ||
| var isArrayLike = (collection) => { | ||
| const length = getLength(collection); | ||
| return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; | ||
| }; | ||
| const isArguments = obj => toString.call(obj) === '[object Arguments]'; | ||
| var identity = value => value; | ||
| const identity = value => value; | ||
| var isFunction = obj => toString.call(obj) === '[object Function]'; | ||
| const getKeys = (obj) => { | ||
| if (!isObject(obj)) return []; | ||
| var optimizeCb = (func, context, argCount) => { | ||
| if (context === void 0) return func; | ||
| switch (argCount == null ? 3 : argCount) { | ||
| case 1: return value => func.call(context, value); | ||
| // The 2-argument case is omitted because we’re not using it. | ||
| case 3: return (value, index, collection) => func.call(context, value, index, collection); | ||
| case 4: return (accumulator, value, index, collection) => func.call(context, accumulator, value, index, collection); | ||
| } | ||
| return Object.keys(obj); | ||
| return (...args) => func.apply(context, args); | ||
| }; | ||
| const isMatch = (object, attrs) => { | ||
| var isMatch = (object, attrs) => { | ||
| const keys = getKeys(attrs); | ||
@@ -54,3 +64,3 @@ const {length} = keys; | ||
| const matcher = attrs => { | ||
| var matcher = attrs => { | ||
| attrs = Object.assign({}, attrs); | ||
@@ -72,3 +82,3 @@ | ||
| const property = path => { | ||
| var property = path => { | ||
| if (!Array.isArray(path)) { | ||
@@ -81,14 +91,2 @@ return shallowProperty(path); | ||
| const optimizeCb = (func, context, argCount) => { | ||
| if (context === void 0) return func; | ||
| switch (argCount == null ? 3 : argCount) { | ||
| case 1: return value => func.call(context, value); | ||
| // The 2-argument case is omitted because we’re not using it. | ||
| case 3: return (value, index, collection) => func.call(context, value, index, collection); | ||
| case 4: return (accumulator, value, index, collection) => func.call(context, accumulator, value, index, collection); | ||
| } | ||
| return (...args) => func.apply(context, args); | ||
| }; | ||
| const baseIteratee = (value, context, argCount) => { | ||
@@ -106,3 +104,3 @@ if (value == null) return identity; | ||
| 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, cb: cb$1 } = lib; | ||
| var map = (obj, iteratee, context) => { | ||
| iteratee = cb$1(iteratee, context); | ||
| const keys = !isArrayLike$1(obj) && getKeys$1(obj); | ||
| iteratee = cb(iteratee, context); | ||
| const keys = !isArrayLike(obj) && getKeys(obj); | ||
| const { length } = keys || obj; | ||
@@ -136,0 +116,0 @@ const results = Array(length); |
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.
0
-100%9891
-6.67%167
-16.92%