1.0.1 • Published 2 years ago

esnext-syntax-check v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

esnext-syntax-check

A tool for checking esnext syntax

$ npm install -S esnext-syntax-check

Usage

const { checkEsnextSyntax } = require('esnext-syntax-check');
const source = 'function* gen(){}';

const result = checkEsnextSyntax(source); 
// => { 'generator function': 1 }

// with custom visitors, the visitors should return a string describing the syntax
const result2 = checkEsnextSyntax('export default 123; function* gen(){}', { ExportDefaultDeclaration: (path) => 'export default declaration' });
// => { 'custom: export default declaration': 1, 'export statement': 1, 'generator function': 1 }