We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7c685f commit 20e55f3Copy full SHA for 20e55f3
index.js
@@ -1,12 +1,13 @@
1
/* MIT license */
2
var colorNames = require('color-name');
3
var swizzle = require('simple-swizzle');
4
+var hasOwnProperty = Object.hasOwnProperty;
5
6
var reverseNames = {};
7
8
// create a list of reverse color names
9
for (var name in colorNames) {
- if (colorNames.hasOwnProperty(name)) {
10
+ if (hasOwnProperty.call(colorNames, name)) {
11
reverseNames[colorNames[name]] = name;
12
}
13
@@ -111,12 +112,11 @@ cs.get.rgb = function (string) {
111
112
return [0, 0, 0, 0];
113
114
- rgb = colorNames[match[1]];
115
-
116
- if (!rgb) {
+ if (!hasOwnProperty.call(colorNames, match[1])) {
117
return null;
118
119
+ rgb = colorNames[match[1]];
120
rgb[3] = 1;
121
122
return rgb;
0 commit comments