mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
delegate to native Object.keys in nightlies
This commit is contained in:
@@ -403,7 +403,8 @@
|
|||||||
// ------------------------- Object Functions: ------------------------------
|
// ------------------------- Object Functions: ------------------------------
|
||||||
|
|
||||||
// Retrieve the names of an object's properties.
|
// Retrieve the names of an object's properties.
|
||||||
_.keys = function(obj) {
|
// ECMA5 has Object.keys(obj) in webkit nightlies
|
||||||
|
_.keys = Object.keys || function(obj) {
|
||||||
if (_.isArray(obj)) return _.range(0, obj.length);
|
if (_.isArray(obj)) return _.range(0, obj.length);
|
||||||
var keys = [];
|
var keys = [];
|
||||||
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys.push(key);
|
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys.push(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user