MCPcopy Index your code
hub / github.com/nodejs/node / convertStringToRegExp

Function convertStringToRegExp

lib/internal/test_runner/utils.js:111–127  ·  view source on GitHub ↗
(str, name)

Source from the content-addressed store, hash-verified

109}
110
111function convertStringToRegExp(str, name) {
112 const match = RegExpPrototypeExec(kRegExpPattern, str);
113 const pattern = match?.[1] ?? str;
114 const flags = match?.[2] || '';
115
116 try {
117 return new RegExp(pattern, flags);
118 } catch (err) {
119 const msg = err?.message;
120
121 throw new ERR_INVALID_ARG_VALUE(
122 name,
123 str,
124 `is an invalid regular expression.${msg ? ` ${msg}` : ''}`,
125 );
126 }
127}
128
129const kBuiltinDestinations = new SafeMap([
130 ['stdout', process.stdout],

Callers 4

runFunction · 0.85
parseCommandLineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…