0.2.1 • Published 5 years ago

fo-matters v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

FO-Matters

A collection of formatting tool, useful for formatting strings, numbers, and currency.

npm module dependencies

About FO-Matters?

We are in the beginning stages of this project. Currently, there are minimal tools for formatting strings, numbers, and currency (USD ONLY), but we will be adding more in the near future!

Full typescript support! :)

Installation

To use with node:

$ npm install fo-matters --save

Javascript:

const fo = require('fo-matters');

ES6 and above:

import fo from 'fo-matters'

(note that using latest is taking a significant risk that fo-matters API changes could break your code.)

API

import fo from 'fo-matters'

// Strings

fo.lettersOnly('alph@123')
// ===> 'alph'

fo.alphaNumericOnly('alph@123')
// ===> 'alph123'

fo.minLength('alph@123', 10)
// ===> false

fo.maxLength('alph@123', 4)
// ===> 'alph'

fo.capitalizeFirstLetter('alph@123')
// ===> 'Alph@123'


// Numbers

fo.number(91234.56)
// ===> '91,234.56'

fo.numberRound(91234.56)
// ===> '91,235'

fo.stripNumber('91,234.56')
// ===> 91234.56


// Currency (USD ONLY)

fo.currency(91234.56)
// ===> '$91,234.56'

fo.currencyRound(91234.56)
// ===> '$91,235'

fo.stripCurrency('$91,234.56')
// ===> 91234.56

Acknowledgements

Thanks to Bryan Ricci! License MIT.

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago