1.0.1 • Published 3 years ago

get-large-numbers v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

get-large-numbers

Coverage Status Build Status

An npm library for readable developer-friendly large numbers

What is it?

It is a simple library that provide some easy methods to get large numbers.library is inspired by this code war kata.

Installation

$ npm i get-large-numbers

Usage

you just need to import it in a file

require("get-large-numbers");

Core

These methods come bundled with this library :

hundred

Transform any given number to hundred.

Number(2).hundred();
//=> 200

thousand

Transform any given number to thousnad.

Number(2).thousand();
//=> 2000

million

Transform any given number to million.

Number(2).million();
//=> 2000000

billion

Transform any given number to billion .

Number(2).billion();
//=> 2000000000

trillion

Transform any given number to trillion

Number(2).trillion();
//=> 2000000000000

quadrillion

Transform any given number to quadrillion.

Number(2).quadrillion();
//=> 2000000000000000

quintillion

Transform any given number to quintillion.

Number(2).quintillion();
//=> 2000000000000000000

How to chain

methods can be chained but currently dont accept any parameter.

Number(13).thousand().hundred();
//=> 1300000

Alternative Syntax

These are two other syntaxes this library supported:

(2).thousand();
//=> 2000

2..thousand();
//=> 2000

LICENSE

MIT License

Copyright (c) 2021 Mohsin Afzal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.0.1

3 years ago

1.0.0

3 years ago