main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1011 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | var _isString = _interopRequireDefault(require("./isString"));
|
---|
| 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
| 8 | /**
|
---|
| 9 | * Escapes the RegExp special characters.
|
---|
| 10 | *
|
---|
| 11 | * @func escapeRegExp
|
---|
| 12 | * @memberOf RA
|
---|
| 13 | * @since {@link https://char0n.github.io/ramda-adjunct/2.21.0|v2.21.0}
|
---|
| 14 | * @category String
|
---|
| 15 | * @sig String -> String
|
---|
| 16 | * @param {string} val the value to escape
|
---|
| 17 | * @return {string}
|
---|
| 18 | * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping|MDN Regular Expressions Escaping}
|
---|
| 19 | * @example
|
---|
| 20 | *
|
---|
| 21 | * RA.escapeRegExp('[ramda-adjunct](https://github.com/char0n/ramda-adjunct)'); //=> '\[ramda\-adjunct\]\(https://github\.com/char0n/ramda\-adjunct\)'
|
---|
| 22 | */
|
---|
| 23 | var escapeRegExp = (0, _ramda.when)(_isString["default"], (0, _ramda.replace)(/[.*+?^${}()|[\]\\-]/g, '\\$&'));
|
---|
| 24 | var _default = escapeRegExp;
|
---|
| 25 | exports["default"] = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.