source:
trip-planner-front/node_modules/escape-string-regexp/index.js@
b738035
Last change on this file since b738035 was 6a3a178, checked in by , 3 years ago | |
---|---|
|
|
File size: 226 bytes |
Rev | Line | |
---|---|---|
[6a3a178] | 1 | 'use strict'; |
2 | ||
3 | var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; | |
4 | ||
5 | module.exports = function (str) { | |
6 | if (typeof str !== 'string') { | |
7 | throw new TypeError('Expected a string'); | |
8 | } | |
9 | ||
10 | return str.replace(matchOperatorsRe, '\\$&'); | |
11 | }; |
Note:
See TracBrowser
for help on using the repository browser.