sempostma / num-encode

num-encode is a zero dependency 1kb module that converts javascript base 10 numbers to utf-8 strings with any base up to the safe limit of 65535.

Home Page:https://www.npmjs.com/package/num-encode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

num-encode

num-encode is a zero dependency 1kb module that converts javascript base 10 numbers to utf-8 strings with any base up to the safe limit of 65535.

Getting Started

CDN

<script src="https://cdn.jsdelivr.net/npm/num-encode@1.0.0/dist/num-encode.min.js"></script>

NPM

npm i -S num-encode

Usage

const { encode, decode } = require('num-encode');
// or
import { encode, decode } from 'num-encode' // if you're using es6
// or
const { encode, decode } = window.numEncode; // if you're using a cdn

const encoded = encode(3123123123321, 256);
console.log(encoded);               // ╗×(¤ôy
console.log(decode(encoded, 256));  // 3123123123321

About

num-encode is a zero dependency 1kb module that converts javascript base 10 numbers to utf-8 strings with any base up to the safe limit of 65535.

https://www.npmjs.com/package/num-encode

License:MIT License


Languages

Language:JavaScript 100.0%