function escapeIdentifierLoop(str) {
var escaped = '"'
for (var i = 0; i < str.length; i++) {
var c = str[i]
if (c === '"') {
escaped += c + c
} else if (c === '\0') {
throw new Error("\\0 forbidden");
} else {
escaped += c
}
}
escaped += '"'
return escaped
}
function escapeIdentifierRegexpAndError(str) {
if (/\0/.test(str)) throw new Error("\\0 forbidden");
return '"' + str.replace(/"/g, '""') + '"'
}
function escapeIdentifierRegexpAndInvisibleSub(str) {
return '"' + str.replace(/["\0]/g, '""') + '"'
}
function escapeIdentifierUnsafe(str) {
return '"' + str.replace(/"/g, '""') + '"'
}
const strings = [];
const escaped = [];
for (let i = 0; i < 100_000; i++) {
strings.push(String(i) + "some_identifier" + String(i));
}