npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-in-bits

v1.1.4

Published

js-in-bit make converting from any format (hexa,binary,deciaml) to other is very easily

Downloads

16

Readme

js-in-bits

js-in-bits makes converting between decimal, binary, hexadecimal very easily in javascript

Installation

Use npm to install js-ib-bits.

npm install js-in-bits

Usage


// Main functions
const {hexa,decimal,binary,octal} = require('js-in-bits')


hexa(10101010,'binary',true) # returns '0xAA'
hexa(10101010,'binary',false) # returns 'AA'
hexa(92,'decimal') # returns '5C'

binary('AA','hexa') # returns '10101010'
binary('22FFAAB8','hexa',true) # returns '0010_0010_1111_1111_1010_1010_1011_1000'
binary('200','decimal') # returns '11001000'


decimal('6F','hexa') # returns '111'
decimal('11001000','binary') # return '200'

octal('100','decimal') # returns '144'
octal('150A','hexa') # returns '12412'

/* NOTE:: In case you don't determine the type of number(second argument)that you want to convert it 
in "hexa()" | "binary()" be care that number will be treated as "decimal"  */

/* NOTE:: In case you don't determine the type of number(second argument)that you want to convert it 
in "decimal()" be care that number will be treated as "binary"  */

/* NOTE:: In case you don't determine the type of number(second argument)that you want to convert it 
in "octal()" be care that number will be treated as "decimal"  */


hexa(10101010) # returns '9A2112'
decimal('100') # returns 4 


// Extra functions 
const {isDecimal,isBinary,isHexa} = require('js-in-bits')

isDecimal(122) # returns true
isDecimal('A1222') # returns false
isDecimal(10101010) # returns true

isBinary(101010) # returns true
isBinary("10A21011") # returns false

isHexa('AEGFEDB') # returns false
isHexa('A69') # returns true
isHexa('0xAE') # returns true
isHexa('0XGT') # returns false

Arguments

Functions

- hexa(number,type,contain_ox),
- binary(number,type,separate_with_underScore),
- decimal(number,type)
- octal(number,type)

number: that number you want to convert it (required)
type: type of number you want to convert it (required when a number can be represented in two formats)
contain_ox: print the return value from hexa() concatenating with 0x (optional)
separate_with_underScore: separate the return value from binary() aftey every 4-digits (optional)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT