Skip to content

yaypaul/util__number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

utils__number

Prototype Number Utilities
I created these utilities some time ago for my own projects. They will have gone through numerous versions, I've tried to keep them small, only including operations I find myself doing time after time. I finally found the time to make proper repros and read me files so I could upload them. I hope you find them as useful as I do!

Version

2.2

Installation

As these are Prototypes and not framework functions, all you need to do is load the file as part of your stack. I recommend after your other library includes.

Usage

addCommas

Parses a number and adds commas in the correct places. (In most cases toLocaleString has now superceded this, but it still has it's uses)

( Number ).addCommas();
//3333000.42 => 3,333,000.42

addRounding

Parses a number and rounds it in a manner similar to Facebook.

( Number ).addRounding();
//12000 => 12K
//1200000 => 1.2M
//1200000000 => 1.2B
//Up to QN

Change Log

2.2 Adjusted comments to match read me. Updated code layout for readability. 2.1 Added addRounding function.
2.0 Rebuilt script to be prototypes instead of framework functions.
1.0 Added addCommas function.

License

MIT
It's Free!

About

Prototype Number Utilities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published