Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return matches.map((match) => {
let exec = regexpClone(I18N_REGEX).exec(match);
// Default to no description when it is not provided.
let desc = (exec[2] || '(no description provided)').trim();
// replace {{$variableName}} with {{ $variableName}} to avoid {$ getting recognised as
// google.getMsg format
let text = exec[1].replace('{$', '{ $');
let varName = undefined;
if (prevMsgs[`MSG_${messageVarPrefix}`]) {
for (let msg of prevMsgs[`MSG_${messageVarPrefix}`]) {
if (msg.text === text && msg.desc === desc && !msg.used) {
varName = msg.key;
msg.used = true;
used.add(msg.index);
break;
}
}
}