hide-text

1.0.4 • Public • Published

Hide-text

Convert a string of characters to asterisks or any other placeholder. It's great for masking information like API keys or any other data you don't want to fully show.

Coverage StatusBuild StatusCode Style

Installation

npm i hide-text

Tests

Describe and show how to run the tests with code examples.

How to use?

After you require or import:

    let result = hideText('this is your original string', { placeholder: '#', showLeft: 4, showRight: 0, trim: 0 })
    //result -> "this ## #### ######## ######"

Config

Hide-text supports three ways to define config.

  • placeholder: character that is going to replace the original text. Default: '*'
  • showLeft: show this many characters in the left side of the string. Default: 0
  • showRight: show this many characters in the right side of the string. Default: 0
  • trim: reduce the result string to this many characters. Default: 0

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT.

Dependencies (0)

    Dev Dependencies (17)

    Package Sidebar

    Install

    npm i hide-text

    Weekly Downloads

    13

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    7.63 kB

    Total Files

    6

    Last publish

    Collaborators

    • waltercj