2.2.0 • Published 11 months ago

@aegenet/belt-str-escape-regex v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

npm version

@aegenet/belt-str-escape-regex

Escape String RegExp

Fork of https://github.com/sindresorhus/escape-string-regexp/ (this project, unfortunately, does not work well with TypeScript)

💾 Installation

yarn add @aegenet/belt-str-escape-regex@^2.0.0
# or
npm i @aegenet/belt-str-escape-regex@^2.0.0

📝 Usage

import { escapeRegex } from '@aegenet/belt-str-escape-regex';

const result = escapeRegex('Hello');
// result = 'Hello'
const result = escapeRegex('Hell{o} [you]');
// result = 'Hell\{o\} \[you\]'
const result = escapeRegex('');
// result = ''
const result = escapeRegex(null);
// throw Error 'Invalid usage: argument provided is not a string.'
const result = escapeRegex(undefined);
// throw Error 'Invalid usage: argument provided is not a string.'
2.2.0

11 months ago

2.1.0

12 months ago

1.6.2

1 year ago

1.7.0

1 year ago

2.0.0

1 year ago

1.5.0

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago