How to use the esutils.keyword.isReservedWordES6 function in esutils

To help you get started, we’ve selected a few esutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github power-assert-js / espower / lib / create-node-with-loc.js View on Github external
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);
  }
};
github tivac / modular-css / packages / webpack / loader.js View on Github external
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])};`);
        });
github tivac / modular-css / packages / rollup / rollup.js View on Github external
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)};`);
                });
            }