mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-15 05:07:49 +00:00
Rename useNativeBind and useNativeKeys to isBindFast and isKeysFast.
Former-commit-id: 9f001b030dc49146b177678443406720c436ac0b
This commit is contained in:
@@ -57,14 +57,14 @@
|
|||||||
'hasDontEnumBug',
|
'hasDontEnumBug',
|
||||||
'inLoop',
|
'inLoop',
|
||||||
'init',
|
'init',
|
||||||
|
'isKeysFast',
|
||||||
'iteratedObject',
|
'iteratedObject',
|
||||||
'loopExp',
|
'loopExp',
|
||||||
'object',
|
'object',
|
||||||
'objectBranch',
|
'objectBranch',
|
||||||
'shadowed',
|
'shadowed',
|
||||||
'top',
|
'top',
|
||||||
'useHas',
|
'useHas'
|
||||||
'useNativeKeys'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/** Used to minify variables and string values to a single character */
|
/** Used to minify variables and string values to a single character */
|
||||||
|
|||||||
10
lodash.js
10
lodash.js
@@ -129,10 +129,10 @@
|
|||||||
var hasDontEnumBug = !propertyIsEnumerable.call({ 'valueOf': 0 }, 'valueOf');
|
var hasDontEnumBug = !propertyIsEnumerable.call({ 'valueOf': 0 }, 'valueOf');
|
||||||
|
|
||||||
/* Detect if `Function#bind` exists and is inferred to be fast (i.e. all but V8) */
|
/* Detect if `Function#bind` exists and is inferred to be fast (i.e. all but V8) */
|
||||||
var useNativeBind = nativeBind && /\n|Opera/.test(nativeBind + toString.call(window.opera));
|
var isBindFast = nativeBind && /\n|Opera/.test(nativeBind + toString.call(window.opera));
|
||||||
|
|
||||||
/* Detect if `Object.keys` exists and is inferred to be fast (i.e. V8, Opera, IE) */
|
/* Detect if `Object.keys` exists and is inferred to be fast (i.e. V8, Opera, IE) */
|
||||||
var useNativeKeys = nativeKeys && /^.+$|true/.test(nativeKeys + !!window.attachEvent);
|
var isKeysFast = nativeKeys && /^.+$|true/.test(nativeKeys + !!window.attachEvent);
|
||||||
|
|
||||||
/** Detect if sourceURL syntax is usable without erroring */
|
/** Detect if sourceURL syntax is usable without erroring */
|
||||||
try {
|
try {
|
||||||
@@ -289,7 +289,7 @@
|
|||||||
' <%= objectBranch.beforeLoop %>;\n<%' +
|
' <%= objectBranch.beforeLoop %>;\n<%' +
|
||||||
|
|
||||||
// iterate own properties using `Object.keys` if it's fast
|
// iterate own properties using `Object.keys` if it's fast
|
||||||
' if (useNativeKeys && useHas) { %>' +
|
' if (isKeysFast && useHas) { %>' +
|
||||||
' var props = nativeKeys(<%= iteratedObject %>),\n' +
|
' var props = nativeKeys(<%= iteratedObject %>),\n' +
|
||||||
' propIndex = -1,\n' +
|
' propIndex = -1,\n' +
|
||||||
' length = props.length;\n' +
|
' length = props.length;\n' +
|
||||||
@@ -500,8 +500,8 @@
|
|||||||
|
|
||||||
data.firstArg = firstArg;
|
data.firstArg = firstArg;
|
||||||
data.hasDontEnumBug = hasDontEnumBug;
|
data.hasDontEnumBug = hasDontEnumBug;
|
||||||
data.useNativeKeys = useNativeKeys;
|
|
||||||
data.hasExp = 'hasOwnProperty.call(' + iteratedObject + ', index)';
|
data.hasExp = 'hasOwnProperty.call(' + iteratedObject + ', index)';
|
||||||
|
data.isKeysFast = isKeysFast;
|
||||||
data.iteratedObject = iteratedObject;
|
data.iteratedObject = iteratedObject;
|
||||||
data.shadowed = shadowed;
|
data.shadowed = shadowed;
|
||||||
data.useHas = data.useHas !== false;
|
data.useHas = data.useHas !== false;
|
||||||
@@ -1981,7 +1981,7 @@
|
|||||||
}
|
}
|
||||||
// use `Function#bind` if it exists and is fast
|
// use `Function#bind` if it exists and is fast
|
||||||
// (in V8 `Function#bind` is slower except when partially applied)
|
// (in V8 `Function#bind` is slower except when partially applied)
|
||||||
else if (useNativeBind || (nativeBind && arguments.length > 2)) {
|
else if (isBindFast || (nativeBind && arguments.length > 2)) {
|
||||||
return nativeBind.call.apply(nativeBind, arguments);
|
return nativeBind.call.apply(nativeBind, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user