color-string 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* MIT license */
|
|
2
2
|
var colorNames = require('color-name');
|
|
3
3
|
var swizzle = require('simple-swizzle');
|
|
4
|
+
var hasOwnProperty = Object.hasOwnProperty;
|
|
4
5
|
|
|
5
6
|
var reverseNames = {};
|
|
6
7
|
|
|
7
8
|
// create a list of reverse color names
|
|
8
9
|
for (var name in colorNames) {
|
|
9
|
-
if (
|
|
10
|
+
if (hasOwnProperty.call(colorNames, name)) {
|
|
10
11
|
reverseNames[colorNames[name]] = name;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
@@ -111,12 +112,11 @@ cs.get.rgb = function (string) {
|
|
|
111
112
|
return [0, 0, 0, 0];
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (!rgb) {
|
|
115
|
+
if (!hasOwnProperty.call(colorNames, match[1])) {
|
|
117
116
|
return null;
|
|
118
117
|
}
|
|
119
118
|
|
|
119
|
+
rgb = colorNames[match[1]];
|
|
120
120
|
rgb[3] = 1;
|
|
121
121
|
|
|
122
122
|
return rgb;
|