Comparing version 1.0.1 to 1.1.0
@@ -86,5 +86,6 @@ /** | ||
function decToHex(decStr) { | ||
function decToHex(decStr, opts) { | ||
var hidePrefix = opts && opts.prefix === false; | ||
var hex = convertBase(decStr, 10, 16); | ||
return hex ? '0x' + hex : null; | ||
return hex ? (hidePrefix ? hex : '0x' + hex) : null; | ||
} | ||
@@ -91,0 +92,0 @@ |
{ | ||
"name": "hex2dec", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Arbitrary precision decimal/hexadecimal converter.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# hex2dec | ||
[![Latest NPM release](https://img.shields.io/npm/v/hex2dec.svg)](https://www.npmjs.com/package/hex2dec) | ||
[![License](https://img.shields.io/npm/l/hex2dec.svg)](https://github.com/donmccurdy/hex2dec/blob/master/LICENSE) | ||
[![Build Status](https://travis-ci.com/donmccurdy/hex2dec.svg?branch=master)](https://travis-ci.com/donmccurdy/hex2dec) | ||
Arbitrary precision decimal↔️hexadecimal converter, from a [blog post](http://www.danvk.org/hex2dec.html) by [Dan Vanderkam](https://github.com/danvk). | ||
@@ -14,4 +18,5 @@ | ||
var hex = converter.hexToDec('0xFA'); // 250 | ||
var dec = converter.decToHex('250'); // '0xfa' | ||
var dec = converter.hexToDec('0xFA'); // 250 | ||
var hex = converter.decToHex('250'); // '0xfa' | ||
var hexString = converter.decToHex('250', { prefix: false }); // 'fa' | ||
``` | ||
@@ -18,0 +23,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17479
8
113
30