mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Optimize method compilation with/without strict mode.
Former-commit-id: 05e4d9282116987b53a817b406c82c140a25c761
This commit is contained in:
12
lodash.js
12
lodash.js
@@ -175,6 +175,9 @@
|
||||
/* Detect if `Object.keys` exists and is inferred to be fast (IE, Opera, V8) */
|
||||
var isKeysFast = nativeKeys && /^.+$|true/.test(nativeKeys + !!window.attachEvent);
|
||||
|
||||
/* Detect if strict mode, "use strict", is inferred to be fast (V8) */
|
||||
var isStrictFast = !isBindFast;
|
||||
|
||||
/** Detect if sourceURL syntax is usable without erroring */
|
||||
try {
|
||||
// The JS engine in Adobe products, like InDesign, will throw a syntax error
|
||||
@@ -631,8 +634,8 @@
|
||||
if (typeof value == 'string') {
|
||||
value = { 'array': value, 'object': value };
|
||||
}
|
||||
data.arrayBranch[prop] = value.array;
|
||||
data.objectBranch[prop] = value.object;
|
||||
data.arrayBranch[prop] = value.array || '';
|
||||
data.objectBranch[prop] = value.object || '';
|
||||
} else {
|
||||
data[prop] = value;
|
||||
}
|
||||
@@ -640,7 +643,8 @@
|
||||
}
|
||||
// set additional template `data` values
|
||||
var args = data.args,
|
||||
firstArg = /^[^,]+/.exec(args)[0];
|
||||
firstArg = /^[^,]+/.exec(args)[0],
|
||||
useStrict = data.useStrict;
|
||||
|
||||
data.firstArg = firstArg;
|
||||
data.hasDontEnumBug = hasDontEnumBug;
|
||||
@@ -648,7 +652,7 @@
|
||||
data.noArgsEnum = noArgsEnum;
|
||||
data.shadowed = shadowed;
|
||||
data.useHas = data.useHas !== false;
|
||||
data.useStrict = data.useStrict !== false;
|
||||
data.useStrict = useStrict == null ? isStrictFast : useStrict;
|
||||
|
||||
if (!('noCharByIndex' in data)) {
|
||||
data.noCharByIndex = noCharByIndex;
|
||||
|
||||
Reference in New Issue
Block a user