mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Ensure revised _.isEqual works correctly in Underscore build.
Former-commit-id: 24c01405f08f8925bfe473d5d7e9ad0a270382b6
This commit is contained in:
15
build.js
15
build.js
@@ -1651,9 +1651,11 @@
|
||||
});
|
||||
});
|
||||
|
||||
// modify `_.every`, `_.find`, and `_.some` to use the private `indicatorObject`
|
||||
source = source.replace(matchFunction(source, 'every'), function(match) {
|
||||
return match.replace(/\(result *= *(.+?)\);/, '!(result = $1) && indicatorObject;');
|
||||
// modify `_.every`, `_.find`, `_.isEqual`, and `_.some` to use the private `indicatorObject`
|
||||
_.each(['every', 'isEqual'], function(methodName) {
|
||||
source = source.replace(matchFunction(source, methodName), function(match) {
|
||||
return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;');
|
||||
});
|
||||
});
|
||||
|
||||
source = source.replace(matchFunction(source, 'find'), function(match) {
|
||||
@@ -1681,7 +1683,7 @@
|
||||
source = source.replace(matchFunction(source, data.methodName), function(match) {
|
||||
return match
|
||||
.replace(/(callback), *thisArg/g, '$1')
|
||||
.replace(/^ *callback *=.+/m, 'callback || (callback = identity);')
|
||||
.replace(/^( *)callback *=.+/m, '$1callback || (callback = identity);')
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1696,11 +1698,6 @@
|
||||
return match.replace(/(?:\s*\/\/.*)*\n( *)if *\(iteratesOwnLast[\s\S]+?\n\1}/, '');
|
||||
});
|
||||
|
||||
// remove JScript [[DontEnum]] fix from `_.isEqual`
|
||||
source = source.replace(matchFunction(source, 'isEqual'), function(match) {
|
||||
return match.replace(/(?:\s*\/\/.*)*\n( *)if *\(hasDontEnumBug[\s\S]+?\n\1}/, '');
|
||||
});
|
||||
|
||||
// remove `noCharByIndex` from `_.reduceRight`
|
||||
source = source.replace(matchFunction(source, 'reduceRight'), function(match) {
|
||||
return match.replace(/}\s*else if *\(noCharByIndex[^}]+/, '');
|
||||
|
||||
Reference in New Issue
Block a user