mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Fixin new map imports.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import SetCache from './SetCache.js'
|
import SetCache from './SetCache.js'
|
||||||
import arrayIncludes from './arrayIncludes.js'
|
import arrayIncludes from './arrayIncludes.js'
|
||||||
import arrayIncludesWith from './arrayIncludesWith.js'
|
import arrayIncludesWith from './arrayIncludesWith.js'
|
||||||
import arrayMap from './arrayMap.js'
|
import map from '../map.js'
|
||||||
import cacheHas from './cacheHas.js'
|
import cacheHas from './cacheHas.js'
|
||||||
|
|
||||||
/** Used as the size to enable large array optimizations. */
|
/** Used as the size to enable large array optimizations. */
|
||||||
@@ -28,7 +28,7 @@ function baseDifference(array, values, iteratee, comparator) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
if (iteratee) {
|
if (iteratee) {
|
||||||
values = arrayMap(values, (value) => iteratee(value))
|
values = map(values, (value) => iteratee(value))
|
||||||
}
|
}
|
||||||
if (comparator) {
|
if (comparator) {
|
||||||
includes = arrayIncludesWith
|
includes = arrayIncludesWith
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import SetCache from './SetCache.js'
|
import SetCache from './SetCache.js'
|
||||||
import arrayIncludes from './arrayIncludes.js'
|
import arrayIncludes from './arrayIncludes.js'
|
||||||
import arrayIncludesWith from './arrayIncludesWith.js'
|
import arrayIncludesWith from './arrayIncludesWith.js'
|
||||||
import arrayMap from './arrayMap.js'
|
import map from '../map.js'
|
||||||
import cacheHas from './cacheHas.js'
|
import cacheHas from './cacheHas.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,7 +28,7 @@ function baseIntersection(arrays, iteratee, comparator) {
|
|||||||
while (othIndex--) {
|
while (othIndex--) {
|
||||||
array = arrays[othIndex]
|
array = arrays[othIndex]
|
||||||
if (othIndex && iteratee) {
|
if (othIndex && iteratee) {
|
||||||
array = arrayMap(array, (value) => iteratee(value))
|
array = map(array, (value) => iteratee(value))
|
||||||
}
|
}
|
||||||
maxLength = Math.min(array.length, maxLength)
|
maxLength = Math.min(array.length, maxLength)
|
||||||
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
|
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './arrayMap.js'
|
import map from '../map.js'
|
||||||
import baseIndexOf from './baseIndexOf.js'
|
import baseIndexOf from './baseIndexOf.js'
|
||||||
import baseIndexOfWith from './baseIndexOfWith.js'
|
import baseIndexOfWith from './baseIndexOfWith.js'
|
||||||
import copyArray from './copyArray.js'
|
import copyArray from './copyArray.js'
|
||||||
@@ -27,7 +27,7 @@ function basePullAll(array, values, iteratee, comparator) {
|
|||||||
values = copyArray(values)
|
values = copyArray(values)
|
||||||
}
|
}
|
||||||
if (iteratee) {
|
if (iteratee) {
|
||||||
seen = arrayMap(array, (value) => iteratee(value))
|
seen = map(array, (value) => iteratee(value))
|
||||||
}
|
}
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
let fromIndex = 0
|
let fromIndex = 0
|
||||||
|
|||||||
4
cond.js
4
cond.js
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that iterates over `pairs` and invokes the corresponding
|
* Creates a function that iterates over `pairs` and invokes the corresponding
|
||||||
@@ -30,7 +30,7 @@ import arrayMap from './.internal/arrayMap.js'
|
|||||||
function cond(pairs) {
|
function cond(pairs) {
|
||||||
const length = pairs == null ? 0 : pairs.length
|
const length = pairs == null ? 0 : pairs.length
|
||||||
|
|
||||||
pairs = !length ? [] : arrayMap(pairs, (pair) => {
|
pairs = !length ? [] : map(pairs, (pair) => {
|
||||||
if (typeof pair[1] != 'function') {
|
if (typeof pair[1] != 'function') {
|
||||||
throw new TypeError('Expected a function')
|
throw new TypeError('Expected a function')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import baseIntersection from './.internal/baseIntersection.js'
|
import baseIntersection from './.internal/baseIntersection.js'
|
||||||
import castArrayLikeObject from './.internal/castArrayLikeObject.js'
|
import castArrayLikeObject from './.internal/castArrayLikeObject.js'
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ import castArrayLikeObject from './.internal/castArrayLikeObject.js'
|
|||||||
* // => [2]
|
* // => [2]
|
||||||
*/
|
*/
|
||||||
function intersection(...arrays) {
|
function intersection(...arrays) {
|
||||||
const mapped = arrayMap(arrays, castArrayLikeObject)
|
const mapped = map(arrays, castArrayLikeObject)
|
||||||
return (mapped.length && mapped[0] === arrays[0])
|
return (mapped.length && mapped[0] === arrays[0])
|
||||||
? baseIntersection(mapped)
|
? baseIntersection(mapped)
|
||||||
: []
|
: []
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import baseIntersection from './.internal/baseIntersection.js'
|
import baseIntersection from './.internal/baseIntersection.js'
|
||||||
import castArrayLikeObject from './.internal/castArrayLikeObject.js'
|
import castArrayLikeObject from './.internal/castArrayLikeObject.js'
|
||||||
import last from './last.js'
|
import last from './last.js'
|
||||||
@@ -22,7 +22,7 @@ import last from './last.js'
|
|||||||
*/
|
*/
|
||||||
function intersectionBy(...arrays) {
|
function intersectionBy(...arrays) {
|
||||||
let iteratee = last(arrays)
|
let iteratee = last(arrays)
|
||||||
const mapped = arrayMap(arrays, castArrayLikeObject)
|
const mapped = map(arrays, castArrayLikeObject)
|
||||||
|
|
||||||
if (iteratee === last(mapped)) {
|
if (iteratee === last(mapped)) {
|
||||||
iteratee = undefined
|
iteratee = undefined
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import baseIntersection from './.internal/baseIntersection.js'
|
import baseIntersection from './.internal/baseIntersection.js'
|
||||||
import castArrayLikeObject from './.internal/castArrayLikeObject.js'
|
import castArrayLikeObject from './.internal/castArrayLikeObject.js'
|
||||||
import last from './last.js'
|
import last from './last.js'
|
||||||
@@ -24,7 +24,7 @@ import last from './last.js'
|
|||||||
*/
|
*/
|
||||||
function intersectionWith(...arrays) {
|
function intersectionWith(...arrays) {
|
||||||
let comparator = last(arrays)
|
let comparator = last(arrays)
|
||||||
const mapped = arrayMap(arrays, castArrayLikeObject)
|
const mapped = map(arrays, castArrayLikeObject)
|
||||||
|
|
||||||
comparator = typeof comparator == 'function' ? comparator : undefined
|
comparator = typeof comparator == 'function' ? comparator : undefined
|
||||||
if (comparator) {
|
if (comparator) {
|
||||||
|
|||||||
4
over.js
4
over.js
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that invokes `iteratees` with the arguments it receives
|
* Creates a function that invokes `iteratees` with the arguments it receives
|
||||||
@@ -18,7 +18,7 @@ import arrayMap from './.internal/arrayMap.js'
|
|||||||
*/
|
*/
|
||||||
function over(iteratees) {
|
function over(iteratees) {
|
||||||
return function(...args) {
|
return function(...args) {
|
||||||
return arrayMap(iteratees, (iteratee) => iteratee.apply(this, args))
|
return map(iteratees, (iteratee) => iteratee.apply(this, args))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import basePickBy from './.internal/basePickBy.js'
|
import basePickBy from './.internal/basePickBy.js'
|
||||||
import getAllKeysIn from './.internal/getAllKeysIn.js'
|
import getAllKeysIn from './.internal/getAllKeysIn.js'
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ function pickBy(object, predicate) {
|
|||||||
if (object == null) {
|
if (object == null) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
const props = arrayMap(getAllKeysIn(object), (prop) => [prop])
|
const props = map(getAllKeysIn(object), (prop) => [prop])
|
||||||
return basePickBy(object, props, (value, path) => predicate(value, path[0]))
|
return basePickBy(object, props, (value, path) => predicate(value, path[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import baseAt from './.internal/baseAt.js'
|
import baseAt from './.internal/baseAt.js'
|
||||||
import basePullAt from './.internal/basePullAt.js'
|
import basePullAt from './.internal/basePullAt.js'
|
||||||
import compareAscending from './.internal/compareAscending.js'
|
import compareAscending from './.internal/compareAscending.js'
|
||||||
@@ -31,7 +31,7 @@ function pullAt(array, ...indexes) {
|
|||||||
const length = array == null ? 0 : array.length
|
const length = array == null ? 0 : array.length
|
||||||
const result = baseAt(array, indexes)
|
const result = baseAt(array, indexes)
|
||||||
|
|
||||||
basePullAt(array, arrayMap(indexes, (index) => isIndex(index, length) ? +index : index).sort(compareAscending))
|
basePullAt(array, map(indexes, (index) => isIndex(index, length) ? +index : index).sort(compareAscending))
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import copyArray from './.internal/copyArray.js'
|
import copyArray from './.internal/copyArray.js'
|
||||||
import isSymbol from './isSymbol.js'
|
import isSymbol from './isSymbol.js'
|
||||||
import stringToPath from './.internal/stringToPath.js'
|
import stringToPath from './.internal/stringToPath.js'
|
||||||
@@ -21,7 +21,7 @@ import toKey from './.internal/toKey.js'
|
|||||||
*/
|
*/
|
||||||
function toPath(value) {
|
function toPath(value) {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
return arrayMap(value, toKey)
|
return map(value, toKey)
|
||||||
}
|
}
|
||||||
return isSymbol(value) ? [value] : copyArray(stringToPath(value))
|
return isSymbol(value) ? [value] : copyArray(stringToPath(value))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import isSymbol from './isSymbol.js'
|
import isSymbol from './isSymbol.js'
|
||||||
|
|
||||||
/** Used as references for various `Number` constants. */
|
/** Used as references for various `Number` constants. */
|
||||||
@@ -37,7 +37,7 @@ function toString(value) {
|
|||||||
}
|
}
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
// Recursively convert values (susceptible to call stack limits).
|
// Recursively convert values (susceptible to call stack limits).
|
||||||
return `${arrayMap(value, (other) => other == null ? other : toString(other))}`
|
return `${map(value, (other) => other == null ? other : toString(other))}`
|
||||||
}
|
}
|
||||||
if (isSymbol(value)) {
|
if (isSymbol(value)) {
|
||||||
return symbolToString ? symbolToString.call(value) : ''
|
return symbolToString ? symbolToString.call(value) : ''
|
||||||
|
|||||||
4
unzip.js
4
unzip.js
@@ -1,5 +1,5 @@
|
|||||||
import arrayFilter from './.internal/arrayFilter.js'
|
import arrayFilter from './.internal/arrayFilter.js'
|
||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import baseProperty from './.internal/baseProperty.js'
|
import baseProperty from './.internal/baseProperty.js'
|
||||||
import isArrayLikeObject from './isArrayLikeObject.js'
|
import isArrayLikeObject from './isArrayLikeObject.js'
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ function unzip(array) {
|
|||||||
let index = -1
|
let index = -1
|
||||||
const result = new Array(length)
|
const result = new Array(length)
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
result[index] = arrayMap(array, baseProperty(index))
|
result[index] = map(array, baseProperty(index))
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import arrayMap from './.internal/arrayMap.js'
|
import map from './map.js'
|
||||||
import unzip from './unzip.js'
|
import unzip from './unzip.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +25,7 @@ function unzipWith(array, iteratee) {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
const result = unzip(array)
|
const result = unzip(array)
|
||||||
return arrayMap(result, (group) => iteratee.apply(undefined, group))
|
return map(result, (group) => iteratee.apply(undefined, group))
|
||||||
}
|
}
|
||||||
|
|
||||||
export default unzipWith
|
export default unzipWith
|
||||||
|
|||||||
Reference in New Issue
Block a user