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

Function re

test/parallel/test-fs-error-messages.js:58–66  ·  view source on GitHub ↗
(literals, ...values)

Source from the content-addressed store, hash-verified

56// Template tag function for escaping special characters in strings so that:
57// new RegExp(re`${str}`).test(str) === true
58function re(literals, ...values) {
59 const escapeRE = /[\\^$.*+?()[\]{}|=!<>:-]/g;
60 let result = literals[0].replace(escapeRE, '\\$&');
61 for (const [i, value] of values.entries()) {
62 result += value.replace(escapeRE, '\\$&');
63 result += literals[i + 1].replace(escapeRE, '\\$&');
64 }
65 return result;
66}
67
68// stat
69{

Callers 1

Calls 1

entriesMethod · 0.45

Tested by

no test coverage detected