Giter VIP home page Giter VIP logo

numer.js's Introduction

numer.js

Numer.js is an open-source JavaScript library for formatting and manipulating numbers.

NPM npm bundle size JavaScript Style Guide

๐ŸŽ Features

  • Numer() constructor
    • format() instance method

๐Ÿ”ง Install

numer.js is available on npm. It can be installed with the following command:

npm install numer.js --save

numer.js is available on yarn as well. It can be installed with the following command:

yarn add numer.js --save

If you don't want to use npm or yarn, numer.min.js can be downloaded to your project source.

๐Ÿ“– Documentation

Constructor

  • Numer(options)
    • Creates a new Numer object.
new Numer(options)

Parameters

  • options
    • An object with some or all of the following properties.

style

The formatting style to use.

  • comma for comma formatting.
  • abbreviation for abbreviation formatting.
  • ordinal for ordinal formatting.

Instance methods

  • Numer.prototype.format(number)
    • Getter function that formats a number according to the formatting options of this Numer object.
format(number)

Parameters

  • number
    • A Number or BigInt to format.

๐Ÿ’ก Usage

๐ŸŽ€ format()

// Node.js
const Numer = require("numer.js");

console.log(new Numer({ style: 'comma' }).format(1000000));
// expected output: "1,000,000"

console.log(new Numer({ style: 'abbreviation' }).format(9812730));
// expected output: "9.8M"

console.log(new Numer({ style: 'ordinal' }).format(1));
// expected output: "1st"

๐Ÿ“œ Changelog

Latest version 0.1.0 (2021-09-07):

  • Numer() constructor
    • format() instance method

Details changes for each release are documented in the CHANGELOG.md.

โ— Issues

If you think any of the numer.js can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

๐Ÿ’ช Contribution

We'd love to have your helping hand on contributions to numer.js by forking and sending a pull request!

Your contributions are heartily โ™ก welcome, recognized and appreciated. (โœฟโ— โ€ฟโ— )

How to contribute:

  • Open pull request with improvements
  • Discuss ideas in issues
  • Spread the word
  • Reach out with any feedback

๐Ÿ† Contributors

Bunlong
Bunlong

โš–๏ธ License

The MIT License License: MIT

numer.js's People

Contributors

bunlong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

phoelapyae

numer.js's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.