str_to_bin
v1.0.0
Published
A small package to transform a positive decimal number into a binary string or array.
Readme
A small package to transform a positive decimal number into a binary string or array.
Install
npm i str_to_binTest
npm testHow to use
const { strToBin } = require('str_to_bin');
const bin = strToBin('5');
console.log(bin); // '101'
const arrBin = strToBin('5', 1);
console.log(arrBin); // [1, 0, 1];