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 🙏

© 2025 – Pkg Stats / Ryan Hefner

numbase

v0.1.1

Published

convert an integer(can be a big number) with any base(radix), represented with any character

Downloads

20

Readme

NumBase

Convert an integer with any base(radix), represented with any character

You can conver a big number! Yeah, can be super big!

Methods

// constructor, by default base string will be all alphanumerics (base62)
NumBase(baseString='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
// encode, default base will be the baseString's length
NumBase::encode(number, base=baseString.length);
// decode, default base will be the baseString's length
NumBase::decode(encodedNumber, base=baseString.length);

Usage

for nodejs

install it with npm:

npm install numbase

then require it:

var Numbase = require('numbase');

for browsers

You can include the script with script tag, or with amd/cmd(such as requirejs, commonjs ) loaders

examples

// Setup an instance with default base string
var base = new NumBase();
// encode a super big number(you must pass it as a string) with default radix 62
base.encode('9999999999999999999999999999999999999999999999999999999999999999');
// returns 'isFUl3RMFVGKeLAbPmHOAA86LLjpGwei1jXh'
// then decode it with default radix 62
base.decode('isFUl3RMFVGKeLAbPmHOAA86LLjpGwei1jXh');
// returns '9999999999999999999999999999999999999999999999999999999999999999'



// Setup an instance with custom base string
base = new NumBase('中国上海市徐汇区');
// Encode an integer, use default radix 8
base.encode(19901230); // returns '国国海区上徐市徐汇'
// Decode a string, with default radix 8
base.decode('国国海区上徐市徐汇'); // returns '19901230'

// Encode an integer, with radix 7
base.encode(19901230, 7); // returns '海海国国中徐中海汇'
// Decode a string, with radix 7
base.decode('海海国国中徐中海汇', 7); // returns '19901230'



// And there is some thing else!
// setup an instance with common letters used in articles
base = new NumBase('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?_+= %&*()#@!$\',;.');
// then encode your words(like lover letters), encode it into numbers!
// you should use decode to encode your words, strange?
base.decode('The furthest distance in the world, is not between life and death. But when I stand in front of you,Yet you don\'t know that I love you!');
// returns '57031381561275606392394756616992749156901193715383571159265195685821406415964188213571176381421833854362042612855929981904540567614578869806954870724353288627661399322034962143689960167076321231141725990698446223883841721866243690267975268687767453140124074'
// and when decode the numbers, people will see the truth
// use encode to decode numbers to words
base.encode('57031381561275606392394756616992749156901193715383571159265195685821406415964188213571176381421833854362042612855929981904540567614578869806954870724353288627661399322034962143689960167076321231141725990698446223883841721866243690267975268687767453140124074');
// returns "The furthest distance in the world, is not between life and death. But when I stand in front of you,Yet you don't know that I love you!"