An npm library for readable developer-friendly large numbers
It is a simple library that provide some easy methods to get large numbers.library is inspired by this code war kata.
$ npm i get-large-numbers
you just need to import it in a file
require("get-large-numbers");
These methods come bundled with this library :
- [
hundred
] - [
thousand
] - [
million
] - [
billion
] - [
trillion
] - [
quadrillion
] - [
quintillion
] - [
sextillion
] - [
septillion
] - [
octillion
] - [
nonillion
]
Transform any given number to hundred.
Number(2).hundred();
//=> 200
Transform any given number to thousnad.
Number(2).thousand();
//=> 2000
Transform any given number to million.
Number(2).million();
//=> 2000000
Transform any given number to billion .
Number(2).billion();
//=> 2000000000
Transform any given number to trillion
Number(2).trillion();
//=> 2000000000000
Transform any given number to quadrillion.
Number(2).quadrillion();
//=> 2000000000000000
Transform any given number to quintillion.
Number(2).quintillion();
//=> 2000000000000000000
methods can be chained but currently dont accept any parameter.
Number(13).thousand().hundred();
//=> 1300000
These are two other syntaxes this library supported:
(2).thousand();
//=> 2000
2..thousand();
//=> 2000
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.