1.0.4 • Published 4 years ago
format-fl v1.0.4
format-fl - a floating point number utility
A floating point number utility to stringify special number representation formats.
Background
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.
Installation
Simple install the npm package:
npm install format-flInstallation from source
Run to install dev-dependencies:
npm ciTests
Run for unit tests:
npm run testRun for code coverage:
npm run coverageDocumentation
Run to generate docs with typedoc:
npm run docsThis command will generate a folder ./docs which includes static-site files.
To use the documentation locally, simply open the ./docs/index.html file.
Build for publishing
If you want to publish this package on npm, simply build the files with
npm run buildand publish the package with
npm publishUsage
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"