veffect
Version:
powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha
24 lines (23 loc) • 553 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.escape = void 0;
/**
* This module provides utility functions for working with RegExp in TypeScript.
*
* @since 2.0.0
*/
/**
* Escapes special characters in a regular expression pattern.
*
* @example
* import * as RegExp from "effect/RegExp"
*
* assert.deepStrictEqual(RegExp.escape("a*b"), "a\\*b")
*
* @since 2.0.0
*/
const escape = string => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
exports.escape = escape;
//# sourceMappingURL=RegExp.js.map