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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. 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 (colorNames.hasOwnProperty(name)) {
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
- rgb = colorNames[match[1]];
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;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "color-string",
3
3
  "description": "Parser and generator for CSS color strings",
4
- "version": "1.7.1",
4
+ "version": "1.7.2",
5
5
  "author": "Heather Arthur <fayearthur@gmail.com>",
6
6
  "contributors": [
7
7
  "Maxime Thirouin",