Skip to content

Quickly Convert an Array of Numbers into their Minimal Binary Representations

License

Notifications You must be signed in to change notification settings

DanielJDufour/fast-bin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fast-bin

Quickly Convert an Array of Numbers into their Minimal Binary Representations

install

npm install fast-bin

usage

binarize an array of numbers

const binarize = require('fast-bin/binarize');

const input = [0, 1, 2, 3, 4];
const { data: output, nbits } = binarize({ data: input });
// output is '000001010011100'
// nbits is 3

unbinarize a string

const unbinarize = require('fast-bin/unbinarize');

const data = '00011011';
const nbits = 2;
const arr = unbinarize({ data, nbits });
// arr is [0, 1, 2, 3]

support

Post an issue at https://github.com/danieljdufour/fast-bin

About

Quickly Convert an Array of Numbers into their Minimal Binary Representations

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published