New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

colormin

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colormin - npm Package Compare versions

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 [![Build Status](https://travis-ci.org/ben-eb/colormin.svg?branch=master)](https://travis-ci.org/ben-eb/colormin) [![NPM version](https://badge.fury.io/js/colormin.svg)](http://badge.fury.io/js/colormin) [![Dependency Status](https://gemnasium.com/ben-eb/colormin.svg)](https://gemnasium.com/ben-eb/colormin)
# colormin [![Build Status](https://travis-ci.org/ben-eb/colormin.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/colormin.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/colormin.svg)][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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc