A floating point number utility to stringify special number representation formats.
This project is a task I had to implement for a job interview process. The requirements were a bunch of assertions that have to succeed.
Simple install the npm package:
npm install format-fl
Run to install dev-dependencies:
npm ci
Run for unit tests:
npm run test
Run for code coverage:
npm run coverage
Run to generate docs with typedoc:
npm run docs
This command will generate a folder ./docs
which includes static-site files.
To use the documentation locally, simply open the ./docs/index.html
file.
If you want to publish this package on npm, simply build the files with
npm run build
and publish the package with
npm publish
Import the function and simply use it anywhere you need:
const { format } = require('format-fl')
console.log(format(12342.555, 2))
// logs "12.342,56"
Or in typescript:
import { format } from 'format-fl'
const formattedNumber: string = format(12342.555, 2)
console.log(formattedNumber)
// logs "12.342,56"