Skip to content

Commit

Permalink
lodash: Fix JSDoc entries, rename private constructor Lodash to `Lo…
Browse files Browse the repository at this point in the history
…Dash`, and optimize wrapper methods. [jddalton]
  • Loading branch information
jdalton committed May 7, 2012
1 parent ea66a04 commit 1174d8d
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 159 deletions.
6 changes: 5 additions & 1 deletion build/pre-compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
'isFunc',
'length',
'object',
'Math',
'noaccum',
'prop',
'property',
Expand Down Expand Up @@ -166,6 +165,7 @@
// minify snippet variables/arguments
compiledVars.forEach(function(variable, index) {
result = result.replace(RegExp('([^.]\\b|\\\\n)' + variable + '\\b(?!\'\\s*[\\]:])', 'g'), '$1' + minNames[index]);

// correct `typeof x == 'object'`
if (variable == 'object') {
result = result.replace(RegExp("(typeof [^']+')" + minNames[index] + "'", 'g'), "$1object'");
Expand All @@ -176,6 +176,10 @@
.replace(RegExp(':\\s*' + minNames[index] + '\\s*,', 'g'), ':' + variable + ',')
.replace(RegExp('\\s*' + minNames[index] + '\\s*;', 'g'), variable + ';');
}
if (variable == 'slice') {
// correct `slice.call(arguments)`
result = result.replace(RegExp('\\b' + minNames[index] + '(\\.call\\(arguments\\))'), 'slice$1');
}
});

// minify snippet values
Expand Down
Loading

0 comments on commit 1174d8d

Please sign in to comment.