1.0.0 • Published 7 years ago

cut-hex v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

cut-hex

Build Status

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 promise
cut_hex('#abc123')
  .then(hex => console.log(hex)) // 'abc123'
  .catch(err => console.error(err));

// Here with a given callback function
cut_hex('#abc123', (err, hex) => {
  if (err) console.error(err);

  console.log(hex); // 'abc123'
});

// Also works with no leading # presented
cut_hex('abc123', (err, hex) => {
  if (err) console.error(err);

  console.log(hex); // 'abc123'
});

Development

$ npm test

Changelog

  • 1.0.0
    • Initial Release