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

adnot-beport-large

v1.3.2

Published

Notations used in Antimatter Dimensions, built for break_eternity.js. This set of notations is specifically built for numbers greater than 1e9e15

Downloads

262

Readme

AD Notations for break_eternity (beyond e9e15)

All the notations that are included in the current version of Antimatter Dimensions break_eternity port (by Hexa).

Setup

CDN

The simplest way to use this package is to include these scripts in your HTML page:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/break_eternity.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@antimatter-dimensions/notations"></script>

You can also grab specific versions here:

  • https://github.com/Patashu/break_eternity.js/releases
  • https://github.com/antimatter-dimensions/notations/releases

npm

npm install @antimatter-dimensions/notations

There is no default export. The correct way to import notations is:

import * as ADBNotations from "@antimatter-dimensions/notations";

Use

All the notations are included inside ADBNotations object:

const scientific = new ADBNotations.ExtendedScientificNotation();

The main method that notations provide is format(value, places)

  • value can be Decimal, number or string which you want to format
  • places is used to format mantissa when number is greater than 1000

You can configure some formatting aspects via ADBNotations.Settings object

const scientific = new ADBNotations.ScientificNotation();

// Outputs "F2E5"
console.log(scientific.format("1ee100000", 2));

// Outputs "F3E5"
ADBNotations.Settings.exponentCommas.show = false;
console.log(scientific.format("1eee100000", 2));

// Outputs "Infinite"
ADBNotations.Settings.isInfinite = decimal => decimal.gte(1e100);
console.log(scientific.format(1e101, 2, 2));

Configuration settings:

  • Settings.isInfinite - function that determines if a Decimal value is infinite (default is decimal => decimal.gte(Decimal.tetrate(10, 1e16)))
  • Settings.numCommas - lower bound for numbers to be formatted with commas (default is 100000)

Extend

Creating your own notations is very simple! Just extend base class Notation and implement the required methods get name() and formatDecimal:

class SimpleNotation extends ADBNotations.Notation {
  get name() {
    return "Simple";
  }

  formatDecimal(value, places) {
    return `Layer: ${value.layer.toFixed(places)}, Exponent: ${value.exponent}`;
  }
}

Build

First, clone the repo

git clone https://github.com/antimatter-dimensions/notations.git
cd notations

Then install npm dependencies

npm install

And then run build command which will build all packs to the dist directory and to the docs directory.

npm run build

To build the AD pack or community pack separately, use build:ad or build:community command.

Contributing

  1. Be reasonable when commiting something.
  2. Be original when making a new notation.

Acknowledgements

Thanks to Omsi for the scaffolding of docs page. Thanks to the original notation code for the pre e9e15 code, and for making this possible.