MCPcopy
hub / github.com/Pythagora-io/pythagora / stringToRegExp

Function stringToRegExp

src/utils/common.js:217–224  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

215}
216
217function stringToRegExp(str) {
218 let idValue = str.match(regExpRegex);
219 if (idValue && idValue[1]) {
220 const [, pattern, flags] = idValue[1].match(/^\/(.*)\/([gimuy]+)?$/);
221 return new RegExp(pattern, flags);
222 }
223 return str;
224}
225
226const getCircularReplacer = () => {
227 const seen = new WeakSet();

Callers 3

reviverFunction · 0.85
jsonObjToMongoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected