Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isValidIdentifier = (name) => {
if (typeof name !== 'string' || keyword.isReservedWordES6(name, true)) {
return false;
} else if (name === 'await') {
// invalid in module, valid in script; better be safe (see #4952)
return false;
} else {
return keyword.isIdentifierNameES6(name);
}
};
Object.keys(exported).forEach((ident) => {
if(keyword.isReservedWordES6(ident) || !keyword.isIdentifierNameES6(ident)) {
this.emitWarning(new Error(`Invalid JS identifier "${ident}", unable to export`));
return;
}
out.push(`export var ${ident} = ${JSON.stringify(exported[ident])};`);
});
Object.entries(exported).forEach(([ ident, value ]) => {
if(keyword.isReservedWordES6(ident) || !keyword.isIdentifierNameES6(ident)) {
this.warn(`Invalid JS identifier "${ident}", unable to export`);
return;
}
out.push(`export var ${ident} = ${JSON.stringify(value)};`);
});
}