lodash: Use native Object.keys and Array.isArray. [jddalton]

This commit is contained in:
John-David Dalton
2012-04-18 15:10:46 -04:00
parent 9fc5044cf9
commit 78cc8f8b6e
2 changed files with 83 additions and 82 deletions

View File

@@ -394,6 +394,9 @@
*/
var map = iterationFactory({
'top': 'var result=[]',
'beforeLoop': {
'array': 'result=Array(length)'
},
'inLoop': {
'array': 'result[index]=callback(collection[index],index,collection)',
'object': 'result[result.length]=callback(collection[index],index,collection)'
@@ -2490,16 +2493,14 @@
/*--------------------------------------------------------------------------*/
/*
_.keys = nativeKeys ||
keys = nativeKeys || keys;
isArray = nativeIsArray || isArray;
_.isArray = nativeIsArray || function(collection) {
if (!isArguments(arguments)) {
_.isArguments = function(collection) {
return !!(collection && hasOwnProperty.call(collection, 'callee'));
isArguments = function(value) {
return !!(value && hasOwnProperty.call(value, 'callee'));
};
}
*/
/*--------------------------------------------------------------------------*/