Skip to content

d4nyll/escape-chars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Escape special characters in a string

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published