cut-hex
Cut the leading '#' from a hex color code, if presented
Table of contents
Installation
$ npm install --save cut-hex
Or if you prefer yarn:
$ yarn add cut-hex
Usage
const cut_hex = require('cut-hex'); // If no callback function is given, cut_hex returns a promisecut_hex('#abc123') .then(hex => console.log(hex)) // 'abc123' .catch(err => console.error(err)); // Here with a given callback functioncut_hex('#abc123', (err, hex) => { if (err) console.error(err); console.log(hex); // 'abc123'}); // Also works with no leading # presentedcut_hex('abc123', (err, hex) => { if (err) console.error(err); console.log(hex); // 'abc123'});
Development
$ npm test
Changelog
- 1.0.0
- Initial Release