fo-matters

Helpful formatting tools for strings and numbers.

Usage no npm install needed!

<script type="module">
  import foMatters from 'https://cdn.skypack.dev/fo-matters';
</script>

README

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.