mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Make variable naming more consistent and add indicatorObject for more clarity.
Former-commit-id: 27b5730a33222409c69d174962db7a25e06bd373
This commit is contained in:
29
build.js
29
build.js
@@ -1193,19 +1193,6 @@
|
||||
return match.replace(/(?: *\/\/.*\n)*( +)if *\(typeof isSorted[^}]+?}\n/, '');
|
||||
});
|
||||
|
||||
// unexpose "exit early" feature from `_.forEach`, `_.forIn`, and `_.forOwn`
|
||||
source = source.replace(/( +)var forEachIteratorOptions *=[\s\S]+?\n\1.+?;/, function(match) {
|
||||
return match.replace(/=== *false\)/, '=== objectTypes)');
|
||||
});
|
||||
|
||||
source = source.replace(matchFunction(source, 'every'), function(match) {
|
||||
return match.replace(/\(result *= *(.+?)\);/, '!(result = $1) && objectTypes;');
|
||||
});
|
||||
|
||||
source = source.replace(matchFunction(source, 'some'), function(match) {
|
||||
return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && objectTypes;');
|
||||
});
|
||||
|
||||
// remove unused features from `createBound`
|
||||
if (buildMethods.indexOf('partial') == -1) {
|
||||
source = source.replace(matchFunction(source, 'createBound'), function(match) {
|
||||
@@ -1352,6 +1339,22 @@
|
||||
});
|
||||
}());
|
||||
|
||||
// unexpose "exit early" feature from `_.forEach`, `_.forIn`, and `_.forOwn`
|
||||
_.each(['forEach', 'forIn', 'forOwn'], function(methodName) {
|
||||
source = source.replace(matchFunction(source, methodName), function(match) {
|
||||
return match.replace(/=== *false\)/g, '=== indicatorObject)');
|
||||
});
|
||||
});
|
||||
|
||||
// modify `_.every` and `_.some` to use the private `indicatorObject`
|
||||
source = source.replace(matchFunction(source, 'every'), function(match) {
|
||||
return match.replace(/\(result *= *(.+?)\);/, '!(result = $1) && indicatorObject;');
|
||||
});
|
||||
|
||||
source = source.replace(matchFunction(source, 'some'), function(match) {
|
||||
return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;');
|
||||
});
|
||||
|
||||
// replace `_.template`
|
||||
source = source.replace(/^( +)function template[\s\S]+?\n\1}/m, function() {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user