normalize-parser-test

Normalize parser tests

BSD-3-Clause 5 个版本
安装
npm install normalize-parser-test
yarn add normalize-parser-test
pnpm add normalize-parser-test
bun add normalize-parser-test
README

normalize-parser-test

A node.js package for rendering JavaScript parser tests in a uniform way. Exports a single function (default), which takes and returns the text of a syntactically valid ECMAScript 6 program, replacing variable names and constants in a uniform way. Whitespace, comments, and nontrivial names and constants are preserved.

An optional second argument provides an options bag. Current valid options are isModule (to parse as a module) and parseFn (if you want to provide your own parsing function, which should produce Shift-format ASTs). It is not legal to provide both.

Example

let normalize = require('normalize-parser-test').default;
normalize("let[x]=y, unicode\\u{50}, foo,      something = /* kewl */ 42+1337  , bar = 'baz'+\"zz\";");
// returns "let[a]=b, unicode\\u{50}, c,      d = /* kewl */ 1+2  , e = 'f'+\"g\";"
版本列表
2.0.0 2018-09-19
1.0.4 2018-09-18
1.0.3 2017-10-25
1.0.1 2017-10-11
1.0.0 2016-03-25