mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Remove debug and tweak template whitespace for pretty printing.
Former-commit-id: 1f00899af1210dd367718aad4db38453509747c2
This commit is contained in:
30
lodash.js
30
lodash.js
@@ -113,21 +113,21 @@
|
|||||||
|
|
||||||
// the following branch is for iterating arrays and array-like objects
|
// the following branch is for iterating arrays and array-like objects
|
||||||
'<% if (arrayBranch) { %>' +
|
'<% if (arrayBranch) { %>' +
|
||||||
' var length = <%= firstArg %>.length; index = -1;' +
|
'var length = <%= firstArg %>.length; index = -1;' +
|
||||||
' <% if (objectBranch) { %>\n if (length === +length) {\n<% } %>' +
|
' <% if (objectBranch) { %>\nif (length === +length) {\n<% } %>' +
|
||||||
' <%= arrayBranch.beforeLoop %>;\n' +
|
' <%= arrayBranch.beforeLoop %>;\n' +
|
||||||
' while (<%= arrayBranch.loopExp %>) {\n' +
|
' while (<%= arrayBranch.loopExp %>) {\n' +
|
||||||
' <%= arrayBranch.inLoop %>;\n' +
|
' <%= arrayBranch.inLoop %>;\n' +
|
||||||
' }' +
|
' }' +
|
||||||
' <% if (objectBranch) { %>\n }\n<% }' +
|
' <% if (objectBranch) { %>\n}\n<% }' +
|
||||||
'}' +
|
'}' +
|
||||||
|
|
||||||
// the following branch is for iterating an object's own/inherited properties
|
// the following branch is for iterating an object's own/inherited properties
|
||||||
'if (objectBranch) {' +
|
'if (objectBranch) {' +
|
||||||
' if (arrayBranch) { %> else {\n<% }' +
|
' if (arrayBranch) { %>else {\n<% }' +
|
||||||
' if (!hasDontEnumBug) { %> var skipProto = typeof <%= iteratedObject %> == \'function\';\n<% } %>' +
|
' if (!hasDontEnumBug) { %> var skipProto = typeof <%= iteratedObject %> == \'function\';\n<% } %>' +
|
||||||
' <%= objectBranch.beforeLoop %>;\n' +
|
' <%= objectBranch.beforeLoop %>;\n' +
|
||||||
' for (<%= objectBranch.loopExp %>) {\n' +
|
' for (<%= objectBranch.loopExp %>) {' +
|
||||||
' <%' +
|
' <%' +
|
||||||
' if (hasDontEnumBug) {' +
|
' if (hasDontEnumBug) {' +
|
||||||
' if (useHas) { %> if (<%= hasExp %>) {\n <% } %>' +
|
' if (useHas) { %> if (<%= hasExp %>) {\n <% } %>' +
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
' if (useHas) { %> }\n<% }' +
|
' if (useHas) { %> }\n<% }' +
|
||||||
' }' +
|
' }' +
|
||||||
' else {' +
|
' else {' +
|
||||||
' %>' +
|
' %>\n' +
|
||||||
|
|
||||||
// Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
|
// Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
|
||||||
// (if the prototype or a property on the prototype has been set)
|
// (if the prototype or a property on the prototype has been set)
|
||||||
@@ -143,12 +143,11 @@
|
|||||||
// value to true. Because of this Lo-Dash standardizes on skipping
|
// value to true. Because of this Lo-Dash standardizes on skipping
|
||||||
// the the `prototype` property of functions regardless of its
|
// the the `prototype` property of functions regardless of its
|
||||||
// [[Enumerable]] value.
|
// [[Enumerable]] value.
|
||||||
' if (!(skipProto && index == "prototype")' +
|
' if (!(skipProto && index == "prototype")<% if (useHas) { %> && <%= hasExp %><% } %>) {\n' +
|
||||||
' <% if (useHas) { %>\n && <%= hasExp %><% } %>) {\n' +
|
|
||||||
' <%= objectBranch.inLoop %>;\n' +
|
' <%= objectBranch.inLoop %>;\n' +
|
||||||
' }' +
|
' }' +
|
||||||
' <% } %>' +
|
' <% } %>\n' +
|
||||||
' }\n' +
|
' }' +
|
||||||
|
|
||||||
// Because IE < 9 can't set the `[[Enumerable]]` attribute of an
|
// Because IE < 9 can't set the `[[Enumerable]]` attribute of an
|
||||||
// existing property and the `constructor` property of a prototype
|
// existing property and the `constructor` property of a prototype
|
||||||
@@ -159,15 +158,14 @@
|
|||||||
' skipCtor = ctor && ctor.prototype === <%= iteratedObject %>;\n' +
|
' skipCtor = ctor && ctor.prototype === <%= iteratedObject %>;\n' +
|
||||||
' for (var j = 0; j < 7; j++) {\n' +
|
' for (var j = 0; j < 7; j++) {\n' +
|
||||||
' index = shadowed[j];\n' +
|
' index = shadowed[j];\n' +
|
||||||
' if (!(skipCtor && index == "constructor") &&\n' +
|
' if (!(skipCtor && index == "constructor") && <%= hasExp %>) {\n' +
|
||||||
' <%= hasExp %>) {\n' +
|
|
||||||
' <%= objectBranch.inLoop %>;\n' +
|
' <%= objectBranch.inLoop %>;\n' +
|
||||||
' }\n' +
|
' }\n' +
|
||||||
' }\n' +
|
' }' +
|
||||||
'<% }' +
|
'<% }' +
|
||||||
|
|
||||||
' if (arrayBranch) { %>\n }\n<% }' +
|
' if (arrayBranch) { %>\n}<% }' +
|
||||||
'} %>' +
|
'} %>\n' +
|
||||||
|
|
||||||
// add code to the bottom of the iteration function
|
// add code to the bottom of the iteration function
|
||||||
'<%= bottom %>;\n' +
|
'<%= bottom %>;\n' +
|
||||||
|
|||||||
@@ -151,7 +151,7 @@
|
|||||||
Foo.a = 1;
|
Foo.a = 1;
|
||||||
Foo.b = 2;
|
Foo.b = 2;
|
||||||
|
|
||||||
var expected = { 'a': 1, 'b': 2 }; console.log(_.keys(_.extend({}, Foo)))
|
var expected = { 'a': 1, 'b': 2 };
|
||||||
deepEqual(_.extend({}, Foo), expected);
|
deepEqual(_.extend({}, Foo), expected);
|
||||||
|
|
||||||
Foo.prototype = { 'c': 3 };
|
Foo.prototype = { 'c': 3 };
|
||||||
|
|||||||
Reference in New Issue
Block a user