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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ofregexp

v1.0.0

Published

**本人测试用**

Readme

my-test-shengg

本人测试用

The little sister to bignumber.js. See here for some notes on the difference between them.

Features

Set up

The library is the single JavaScript file big.js (or big.min.js, which is big.js minified).

Browser:

<script src='path/to/big.js'></script>

Node.js:

$ npm install big.js
const Big = require('big.js');

ES6 module:

import Big from 'big.mjs';

Use

In all examples below, var, semicolons and toString calls are not shown. If a commented-out value is in quotes it means toString has been called on the preceding expression.

The library exports a single function, Big, the constructor of Big number instances. It accepts a value of type number, string or Big number object.

x = new Big(123.4567)
y = Big('123456.7e-3')             // 'new' is optional
z = new Big(x)
x.eq(y) && x.eq(z) && y.eq(z)      // true

A Big number is immutable in the sense that it is not changed by its methods.

0.3 - 0.1                          // 0.19999999999999998
x = new Big(0.3)
x.minus(0.1)                       // "0.2"
x                                  // "0.3"

The methods that return a Big number can be chained.

x.div(y).plus(z).times(9).minus('1.234567801234567e+8').plus(976.54321).div('2598.11772')
x.sqrt().div(y).pow(3).gt(y.mod(z))    // true

Like JavaScript's Number type, there are toExponential, toFixed and toPrecision methods.

x = new Big(255.5)
x.toExponential(5)                 // "2.55500e+2"
x.toFixed(5)                       // "255.50000"
x.toPrecision(5)                   // "255.50"

The arithmetic methods always return the exact result except div, sqrt and pow (with negative exponent), as these methods involve division.

The maximum number of decimal places and the rounding mode used to round the results of these methods is determined by the value of the DP and RM properties of the Big number constructor.

Big.DP = 10
Big.RM = 1

x = new Big(2);
y = new Big(3);
z = x.div(y)                       // "0.6666666667"
z.sqrt()                           // "0.8164965809"
z.pow(-3)                          // "3.3749999995"
z.times(z)                         // "0.44444444448888888889"
z.times(z).round(10)               // "0.4444444445"

Multiple Big number constructors can be created, each with an independent configuration.

The value of a Big number is stored in a decimal floating point format in terms of a coefficient, exponent and sign.

x = new Big(-123.456);
x.c                                // [1,2,3,4,5,6]    coefficient (i.e. significand)
x.e                                // 2                exponent
x.s                                // -1               sign

For further information see the API reference from the doc folder.

Test

The test directory contains the test scripts for each Big number method.

The tests can be run with Node.js or a browser.

To run all the tests

$ npm test

To test a single method

$ node test/toFixed

For the browser, see single-test.html and every-test.html in the test/browser directory.

big-vs-number.html is a simple application that enables some of the methods of big.js to be compared with those of JavaScript's Number type.

Performance

The perf directory contains two legacy applications and a lib directory containing the BigDecimal libraries used by both.

big-vs-bigdecimal.html tests the performance of big.js against the JavaScript translations of two versions of BigDecimal, its use should be more or less self-explanatory.

The BigDecimal in the npm registry is the GWT version. It has some bugs, see the Node.js script perf/lib/bigdecimal_GWT/bugs.js for examples of flaws in its remainder, divide and compareTo methods.

bigtime.js is a Node.js command-line application which tests the performance of big.js against the GWT version of BigDecimal from the npm registry.

For example, to compare the time taken by the big.js plus method and the BigDecimal add method

$ node bigtime plus 10000 40

This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match.

For help

$ node bigtime -h

Build

If uglify-js is installed globally

$ npm install uglify-js -g

then

$ npm run build

will create big.min.js.

TypeScript

The DefinitelyTyped project has a Typescript type definitions file for big.js.

$ npm install @types/big.js

Any questions about the TypeScript type definitions file should be addressed to the DefinitelyTyped project.

Feedback

Bugs/comments/questions?

Open an issue, or email Michael

Licence

MIT

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]