# hex2dec

> Arbitrary precision decimal/hexadecimal converter.

Latest version **1.1.2** (published 2019-01-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install hex2dec
pnpm add hex2dec
yarn add hex2dec
bun add hex2dec
```

## Health

**Score 38/100 (D)** — status: abandoned.

Positive: has types package; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2019-01-12 |
| First published | 2016-07-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | separate (@types/hex2dec) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Maintainers | donmccurdy |
| Keywords | decimal, hexadecimal, converter, precision, int64, long, hex |

## Links

- npm: https://www.npmjs.com/package/hex2dec
- Repository: https://github.com/donmccurdy/hex2dec
- Homepage: https://github.com/donmccurdy/hex2dec#readme
- Issues: https://github.com/donmccurdy/hex2dec/issues
- npm.io page: https://npm.io/package/hex2dec

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2019-01-12
- 1.1.1 — 2018-12-04
- 1.1.0 — 2018-09-14
- 1.0.1 — 2016-07-10
- 1.0.0 — 2016-07-10

## README

# hex2dec

[![Latest NPM release](https://img.shields.io/npm/v/hex2dec.svg)](https://www.npmjs.com/package/hex2dec)
[![Minzipped size](https://badgen.net/bundlephobia/minzip/hex2dec)](https://bundlephobia.com/result?p=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). Supports non-negative integer values.

## Usage

```
npm install --save hex2dec
```

```javascript
var converter = require('hex2dec');

var dec = converter.hexToDec('0xFA'); // 250
var hex = converter.decToHex('250'); // '0xfa'
var hexString = converter.decToHex('250', { prefix: false }); // 'fa'
```

## Why use hex2dec

`(250).toString(16) === 'fa'` and `250 === 0xFA` both work just fine, and will provide enough precision for most uses. For large (>64-bit) numbers, however, precision is lost. This utility provides a higher-precision alternative.

## License

This code may be used under the [Apache 2 license](https://github.com/donmccurdy/hex2dec/blob/master/LICENSE).

---
_Source: https://npm.io/package/hex2dec · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
