Skip to content

Commit 937b690

Browse files
authored
fix to.keyword returning Object.prototype values (#67)
1 parent 4daceef commit 937b690

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var colorNames = require('color-name');
33
var swizzle = require('simple-swizzle');
44
var hasOwnProperty = Object.hasOwnProperty;
55

6-
var reverseNames = {};
6+
var reverseNames = Object.create(null);
77

88
// create a list of reverse color names
99
for (var name in colorNames) {

test/basic.js

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ assert.equal(string.to.hwb([280, 40, 60], 0.3), 'hwb(280, 40%, 60%, 0.3)');
216216
assert.equal(string.to.hwb([280, 40, 60], 0), 'hwb(280, 40%, 60%, 0)');
217217

218218
assert.equal(string.to.keyword([255, 255, 0]), 'yellow');
219+
assert.equal(string.to.keyword(['constructor']), undefined);
219220
assert.equal(string.to.keyword([100, 255, 0]), undefined);
220221

221222
// Make sure .get() doesn't return object prototype values (regression test, #44)

0 commit comments

Comments
 (0)