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

unlimint

v0.1.5

Published

Pure TypeScript library for dealing with insanely large integers

Downloads

6

Readme

Unlimint

Unlimint is a Node.js library for working with insanely large integers. It is made in pure TypeScript and has no dependencies. Types are included.

Installation

npm install unlimint

Usage

import UnlimInt from 'unlimint';

const hex = '1234567890abcdef1234567890abcdef';
const dec = '1234567890123456789012345678901234567890';
const bin = '1010101010101010101010101010101010101010101010101010101010101010';

const hexInt1 = UnlimInt.fromHex(hex);
const hexInt2 = UnlimInt.fromString(hex, 16);

const decInt1 = UnlimInt.fromDecimal(dec);
const decInt2 = UnlimInt.fromString(dec, 10);

const binInt1 = UnlimInt.fromBinary(bin);
const binInt2 = UnlimInt.fromString(bin, 2);

// all arguments are UnlimInt unless the argument is an index, radix, string, or shift
// operations prefixed with 'c' return a new instance, others mutate the instance and return it

const sum = hexInt1.add(hexInt2);
const sub = hexInt1.sub(hexInt2);
const mul = hexInt1.mul(hexInt2);
const div = hexInt1.div(hexInt2);
const mod = hexInt1.mod(hexInt2);

const pow = hexInt1.pow(UnlimInt.fromNumber(2));

const and = hexInt1.bitAnd(hexInt2);
const or = hexInt1.bitOr(hexInt2);
const xor = hexInt1.bitXor(hexInt2);
const not = hexInt1.bitNot();

const lShift = hexInt1.cshiftLeft(2);
const rShift = hexInt1.cshiftRight(2);

const cmp = hexInt1.compare(hexInt2);
const eq = hexInt1.equals(hexInt2);
const gt = hexInt1.greaterThan(hexInt2);
const lt = hexInt1.lessThan(hexInt2);
const gte = hexInt1.greaterThanOrEqualTo(hexInt2);
const lte = hexInt1.lessThanOrEqualTo(hexInt2);

// toString() accepts radix as an argument (default is 10, radix must be between 2 and 36)
const hexStr = hexInt1.toString(16);
const decStr = hexInt1.toString(10);
const binStr = hexInt1.toString(2);

License

GPL-3.0 © 1nchhh

Author

All work is done by me