How to use the espurify function in espurify

To help you get started, we’ve selected a few espurify 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 teppeis / closure-ts / src / generator.ts View on Github external
function extractProvide(
  statement: estree.Statement | estree.ModuleDeclaration,
  provides: string[]
): boolean {
  if (
    statement.type === Syntax.ExpressionStatement &&
    statement.expression.type === Syntax.CallExpression
  ) {
    const callExp = statement.expression;
    const firstArg = callExp.arguments[0];
    if (
      firstArg &&
      firstArg.type === Syntax.Literal &&
      deepEqual(espurify(callExp.callee), {
        type: 'MemberExpression',
        computed: false,
        object: {
          type: 'Identifier',
          name: 'goog',
        },
        property: {
          type: 'Identifier',
          name: 'provide',
        },
      })
    ) {
      if (typeof firstArg.value !== 'string') {
        throw new Error('Unexpected value: ' + firstArg.value);
      }
      provides.push(firstArg.value!);
github azu / ast-source / src / ASTDataContainer.js View on Github external
cloneValue() {
        return espurify(this.value);
    }

espurify

Clone AST without extra properties

MIT
Latest version published 6 months ago

Package Health Score

74 / 100
Full package analysis