Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let id;
let value;
for (i = 0, len = pattern.length; i < len; i += 1) {
part = pattern[ i ];
// Exist early for string parts.
if (typeof part === "string") {
result += part;
continue;
}
id = part.id;
// Enforce that all required values are provided by the caller.
if (!(values && src$utils$$.hop.call(values, id))) {
values[ id ] = undefined;
if(part.options && (part.options["undefined"] || part.options["=undefined"])) {
values[ id ] = undefined;
} else {
values[ id ] = "{" + id + "}";
}
}
value = values[ id ];
// Recursively format plural and select parts' option — which can be a
// nested pattern structure. The choosing of the option to use is
// abstracted-by and delegated-to the part helper object.
if (part.options) {
const opt = part.getOption(value);
if(opt) {