Fork me on GitHub

Shift Validator

determines whether a Shift AST represents an ECMAScript program

We call an AST valid if it represents an ECMAScript program. The Shift AST format was designed to permit the fewest possible conforming ASTs that are not valid. For various reasons, it is impossible to exclude all invalid ASTs. This module distinguishes valid Shift ASTs from invalid ones.


npm install shift-validator


import isValid, {Validator} from "shift-validator";
isValid(myAst); // Boolean
Validator.validate(myAst); // [ValidationError]