(This README is written using Markdown notation, for better viewing visit: https://goo.gl/aIEm4Y)
This is my submission for the Crossover Tech Trial. A NodeJS package which can be used to extend back-end and front-end applications alike with the ability to transform number types less than a Quadrillion in the short scale to prettified strings.
The package includes two demo files, one for back-end (using NodeJS) and another for front-end (browser).
Back-end usage of Number Prettifier requires having NodeJS installed.
For more information on installing NodeJS visit: https://nodejs.org/
In order to install requirements for back-end usage, specially if you plan on running specs, navigate to the Code
folder and run on the terminal:
$ npm install
This will install dependencies.
Usage in NodeJS applications is straight-forward:
var Pretty = require('./prettifier');
var pretty = new Pretty();
pretty.prettify_number(1000000); // -> '1M'
For usage in front-end applications, there are no requirements, simply include the prettifier.js
file within HTML as such:
<script src="/path/to/prettifier.js"></script>
and use like this:
var pretty = new Pretty();
pretty.prettify_number(1000000); // -> '1M'
To run specs, navigate to Code
folder and run the following command on the terminal:
$ npm test
Navigate to the Code
folder and run on the terminal:
$ node demo.js
Navigate to the Code
folder and open file demo.html