Have ideas to improve npm?Join in the discussion! »

    fo-matters
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.1 • Public • Published

    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.

    Install

    npm i fo-matters

    DownloadsWeekly Downloads

    2

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    4.66 kB

    Total Files

    16

    Last publish

    Collaborators

    • avatar