mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Make _.toArray work in legacy build.
Former-commit-id: 36866e65670f563b587af51168db9f95f01ed248
This commit is contained in:
17
build.js
17
build.js
@@ -1145,6 +1145,7 @@
|
|||||||
* @returns {String} Returns the modified source.
|
* @returns {String} Returns the modified source.
|
||||||
*/
|
*/
|
||||||
function removeSupportNodeClass(source) {
|
function removeSupportNodeClass(source) {
|
||||||
|
source = removeFunction(source, 'isNode');
|
||||||
source = removeSupportProp(source, 'nodeClass');
|
source = removeSupportProp(source, 'nodeClass');
|
||||||
|
|
||||||
// remove `support.nodeClass` from `shimIsPlainObject`
|
// remove `support.nodeClass` from `shimIsPlainObject`
|
||||||
@@ -1751,6 +1752,7 @@
|
|||||||
dependencyMap.pick = _.without(dependencyMap.pick, 'forIn', 'isObject');
|
dependencyMap.pick = _.without(dependencyMap.pick, 'forIn', 'isObject');
|
||||||
dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString');
|
dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString');
|
||||||
dependencyMap.template = _.without(dependencyMap.template, 'keys', 'values');
|
dependencyMap.template = _.without(dependencyMap.template, 'keys', 'values');
|
||||||
|
dependencyMap.toArray.push('isArray', 'map');
|
||||||
dependencyMap.value = _.without(dependencyMap.value, 'isArray');
|
dependencyMap.value = _.without(dependencyMap.value, 'isArray');
|
||||||
dependencyMap.where.push('find', 'isEmpty');
|
dependencyMap.where.push('find', 'isEmpty');
|
||||||
|
|
||||||
@@ -2320,6 +2322,21 @@
|
|||||||
'}'
|
'}'
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
|
// replace `_.toArray`
|
||||||
|
if (useUnderscoreClone) {
|
||||||
|
source = replaceFunction(source, 'toArray', [
|
||||||
|
'function toArray(collection) {',
|
||||||
|
' if (isArray(collection)) {',
|
||||||
|
' return slice(collection);',
|
||||||
|
' }',
|
||||||
|
" if (collection && typeof collection.length == 'number') {",
|
||||||
|
' return map(collection);',
|
||||||
|
' }',
|
||||||
|
' return values(collection);',
|
||||||
|
'}'
|
||||||
|
].join('\n'));
|
||||||
|
}
|
||||||
|
|
||||||
// replace `_.uniq`
|
// replace `_.uniq`
|
||||||
source = replaceFunction(source, 'uniq', [
|
source = replaceFunction(source, 'uniq', [
|
||||||
'function uniq(array, isSorted, callback, thisArg) {',
|
'function uniq(array, isSorted, callback, thisArg) {',
|
||||||
|
|||||||
Reference in New Issue
Block a user