@mainframe/utils-hex
Hex encoding utilities
Last updated 2 years ago by paul_lecam .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mainframe/utils-hex 
SYNC missed versions from official npm registry.

utils-hex

Utilities for hexadecimal-encoded strings.

Installation

yarn add @mainframe/utils-hex

Usage

import { encodeHex, decodeHex } from 'utils-hex'

const encoded = encodeHex('hello')
const decoded = decodeHex(encoded) // 'hello'

Types

hex

Opaque type representing an hexadecimal-encoded string prefixed with 0x

API

hexType()

Simple identity function casting the provided value as hex to properly type-check.

Arguments

  1. value: any

Returns hex

hexEmpty

Returns 0x value with hex type.

encodeHex()

Arguments

  1. input: string
  2. from?: buffer$Encoding = 'utf8'

Returns hex

decodeHex()

Arguments

  1. input: hex
  2. to?: buffer$Encoding = 'utf8'

Returns string

License

MIT

Current Tags

  • 0.1.1                                ...           latest (2 years ago)

2 Versions

  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |