object-keys
Advanced tools
Comparing version 0.1.8 to 0.2.0
{ | ||
"name": "object-keys", | ||
"version": "0.1.8", | ||
"version": "0.2.0", | ||
"author": "Jordan Harband", | ||
@@ -5,0 +5,0 @@ "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/kriskowal/es5-shim", |
@@ -21,3 +21,3 @@ (function () { | ||
keysShim = function keys(object) { | ||
if (!is.object(object)) { | ||
if (!is.object(object) && !is.array(object)) { | ||
throw new TypeError("Object.keys called on a non-object"); | ||
@@ -24,0 +24,0 @@ } |
@@ -41,2 +41,10 @@ var test = require('tape'); | ||
t.test('works with an array', function (st) { | ||
var arr = [1, 2, 3]; | ||
var theKeys = keys(arr); | ||
st.equal(is.array(theKeys), true, 'returns an array'); | ||
st.deepEqual(theKeys, ['0', '1', '2'], 'Array has expected keys'); | ||
st.end(); | ||
}); | ||
t.test('returns names which are own properties', function (st) { | ||
@@ -43,0 +51,0 @@ forEach(keys(obj), function (name) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5258
117