diff --git a/index.js b/index.js index fea47fa..dd5d2b7 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ var colorNames = require('color-name'); var swizzle = require('simple-swizzle'); var hasOwnProperty = Object.hasOwnProperty; -var reverseNames = {}; +var reverseNames = Object.create(null); // create a list of reverse color names for (var name in colorNames) { diff --git a/test/basic.js b/test/basic.js index 37b730b..db4cbe4 100644 --- a/test/basic.js +++ b/test/basic.js @@ -216,6 +216,7 @@ assert.equal(string.to.hwb([280, 40, 60], 0.3), 'hwb(280, 40%, 60%, 0.3)'); assert.equal(string.to.hwb([280, 40, 60], 0), 'hwb(280, 40%, 60%, 0)'); assert.equal(string.to.keyword([255, 255, 0]), 'yellow'); +assert.equal(string.to.keyword(['constructor']), undefined); assert.equal(string.to.keyword([100, 255, 0]), undefined); // Make sure .get() doesn't return object prototype values (regression test, #44)