Comparing version 1.0.0 to 1.0.1
14
index.js
@@ -5,4 +5,4 @@ 'use strict'; | ||
var toShorthand = require('./lib/toShorthand'); | ||
var stripWhitespace = require('./lib/stripWhitespace'); | ||
var trimLeadingZero = require('./lib/trimLeadingZero'); | ||
var trim = require('./lib/stripWhitespace'); | ||
var zero = require('./lib/trimLeadingZero'); | ||
var ctype = require('./lib/colourType'); | ||
@@ -15,2 +15,6 @@ var color = require('color'); | ||
function longer (a, b) { | ||
return (a && a.length < b.length ? a : b).toLowerCase(); | ||
} | ||
function colormin (colour) { | ||
@@ -29,3 +33,3 @@ if (ctype.isRGBorHSL(colour)) { | ||
var rgba = c.rgbString(); | ||
return trimLeadingZero(stripWhitespace(hsla.length < rgba.length ? hsla : rgba)); | ||
return zero(trim(hsla.length < rgba.length ? hsla : rgba)); | ||
} | ||
@@ -38,3 +42,3 @@ } | ||
})[0]; | ||
return (keyword && keyword.length < colour.length ? keyword : colour).toLowerCase(); | ||
return longer(keyword, colour); | ||
} else if (ctype.isKeyword(colour)) { | ||
@@ -44,3 +48,3 @@ var hex = colourNames[filterColours(function (key) { | ||
})[0]]; | ||
return (hex && hex.length < colour.length ? hex : colour).toLowerCase(); | ||
return longer(hex, colour); | ||
} | ||
@@ -47,0 +51,0 @@ // Possibly malformed, just pass through |
{ | ||
"name": "colormin", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Turn a CSS color into its smallest representation.", | ||
@@ -24,4 +24,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"color": "^0.7.3", | ||
"color-string": "ben-eb/color-string#fix-transparency", | ||
"color": "^0.8.0", | ||
"css-color-names": "0.0.1" | ||
@@ -28,0 +27,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
# colormin [](https://travis-ci.org/ben-eb/colormin) [](http://badge.fury.io/js/colormin) [](https://gemnasium.com/ben-eb/colormin) | ||
# colormin [][ci] [][npm] [][deps] | ||
@@ -20,7 +20,10 @@ > Turn a CSS color into its smallest representation. | ||
colormin works for rgb, rgba, hsl, hsla, hex & css color keywords. See more example output in the [tests](test.js). Note that colormin does not convert invalid CSS colors; it is not a color validator itself. | ||
colormin works for rgb, rgba, hsl, hsla, hex & css color keywords. See more | ||
example output in the [tests](test.js). Note that colormin does not convert | ||
invalid CSS colors; it is not a color validator itself. | ||
## Contributing | ||
Pull requests are welcome. If you add functionality, then please add unit tests to cover it. | ||
Pull requests are welcome. If you add functionality, then please add unit tests | ||
to cover it. | ||
@@ -30,1 +33,5 @@ ## License | ||
MIT © Ben Briggs | ||
[ci]: https://travis-ci.org/ben-eb/colormin | ||
[deps]: https://gemnasium.com/ben-eb/colormin | ||
[npm]: http://badge.fury.io/js/colormin |
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
2
88
36
0
0
5628
+ Addedcolor@0.8.0(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcolor-string@0.3.0(transitive)
- Removedcolor@0.7.3(transitive)
- Removedcolor-name@1.0.1(transitive)
- Removedcolor-string@0.2.4(transitive)
Updatedcolor@^0.8.0