tiny-es-checker
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

es-checker

Check ES6 ES7 ES8 ES9 ES10 ES11 ES12.....

Check whether ES syntax and APIs are used in the code.

In the actual development situation, there are some need to check whether the latest ES syntax are used in the code to  decide if compatibility processing is required, such as in mini-programs, some older websites, and so on.

Usage

Install

yarn add es-checker

How to use

function type

type ecmaCheck = (filesArgs: string | string[], target: EcmaVersionType = 'es6', config: ConfigType) => void

import

import ecmaCheck from 'es-checker'

file

// single file
ecmaCheck('a.js', 'es6')

// mut files
ecmaCheck(['a.js', 'b.js'], 'es6')

target

ecmaCheck('a.js', 'es7')

config: (fast-glob options)

ecmaCheck('a.js', 'es7', {
  dir: '',
  ignore: []
})

Type

EcmaVersionType

export type EcmaVersionType = 'es6' | 'es7' | 'es8' | 'es9' | 'es10' | 'es11' | 'es12' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021'

ConfigType

type ConfigType = {
  dir?: string;  // cwd
  ignore?: string | string[]; // some files to ignore
}

TODO

  • [ ] bin command support

Readme

Keywords

none

Package Sidebar

Install

npm i tiny-es-checker

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

15.9 kB

Total Files

10

Last publish

Collaborators

  • simida