JSPM

special-escape

0.1.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 3
    • Score
      100M100P100Q22145F
    • License MIT

    Package Exports

    • special-escape

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (special-escape) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    special-escape

    Escape special characters in a string

    Installation

    NPM

    special-escape is published at npmjs.com, and can be installed using npm or yarn.

    $ npm install special-escape  # npm
    $ yarn add special-escape     # yarn
    import resolveWhen from 'special-escape';       // ES6+
    const resolveWhen = require('special-escape');  // ES5

    Usage

    const specialChars = ['+', '-', '=', '>', '.', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*', '?', ':', '\\', '/',]
    
    const escapedString = escapeChars('$2a$10$!NgGQwxmjy..4aQTdsOJw\\O7HUd6FfiFQ2e/2F6XJQh1PeZjWlEbmK', specialChars);
    
    assert(escapedString, '$2a$10$\!NgGQwxmjy\.\.4aQTdsOJw\\O7HUd6FfiFQ2e\/2F6XJQh1PeZjWlEbmK');