0.1.1 • Published 5 years ago

special-escape v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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');
0.1.1

5 years ago

0.1.0

6 years ago