Ensure revised _.isEqual works correctly in Underscore build.

Former-commit-id: 24c01405f08f8925bfe473d5d7e9ad0a270382b6
This commit is contained in:
John-David Dalton
2012-11-29 08:21:01 -08:00
parent 52cddc015b
commit 3a5ed6e800
3 changed files with 34 additions and 34 deletions

View File

@@ -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[^}]+/, '');