How to use automatic-semicolon-insertion - 1 common examples

To help you get started, we’ve selected a few automatic-semicolon-insertion 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 decaffeinate / decaffeinate / src / stages / semicolons / index.ts View on Github external
static run(content: string): StageResult {
    const log = logger(this.name);
    log(content);

    const editor = new MagicString(content);
    const ast = parse(content, {
      tokens: true
    });

    const { insertions, removals } = asi(content, ast);

    insertions.forEach(({ index, content }) => editor.appendLeft(index, content));
    removals.forEach(({ start, end }) => editor.remove(start, end));

    return {
      code: editor.toString(),
      suggestions: []
    };
  }
}

automatic-semicolon-insertion

Insert missing semicolons, remove unneeded ones.

MIT
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis

Popular automatic-semicolon-insertion functions