{"_id":"esvalid","_rev":"162556","name":"esvalid","description":"confirm that a SpiderMonkey format AST represents an ECMAScript program","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"constellation","email":"utatane.tea@gmail.com"},{"name":"michaelficarra","email":"npm@michael.ficarra.me"}],"time":{"modified":"2021-06-03T11:42:02.000Z","created":"2014-06-23T10:18:06.903Z","1.1.0":"2014-07-23T16:28:44.659Z","1.0.0":"2014-07-11T16:16:30.910Z","0.0.2":"2014-06-30T03:13:36.491Z","0.0.1":"2014-06-23T10:18:06.903Z"},"users":{},"author":{"name":"Michael Ficarra"},"repository":{"type":"git","url":"git@github.com:michaelficarra/esvalid.git"},"versions":{"1.1.0":{"name":"esvalid","version":"1.1.0","description":"confirm that a SpiderMonkey format AST represents an ECMAScript program","main":"index","scripts":{"test":"make lint test"},"files":["index.js"],"repository":{"type":"git","url":"git@github.com:michaelficarra/esvalid.git"},"keywords":["esvalid","ECMAScript","ES262","SpiderMonkey","AST","validate","validator","valid"],"author":{"name":"Michael Ficarra"},"license":"3-Clause BSD","bugs":{"url":"https://github.com/michaelficarra/esvalid/issues"},"homepage":"https://github.com/michaelficarra/esvalid","dependencies":{"esutils":"^1.1.4","object-assign":"^0.3.1"},"devDependencies":{"async":"0.9.0","coffee-script":"1.7.1","colors":"0.6.2","commander":"2.2.0","eslint":"^0.6.2","esprima":"^1.2.2","express":"4.4.4","istanbul":"^0.2.11","lodash":"2.4.1","mkdirp":"0.5.0","mocha":"^1.20.1","optimist":"0.6.1","request":"2.36.0","underscore":"1.6.0","xyz":"^0.4.0"},"gitHead":"3c00dbaa88073cb1b95e62072ebb5e8c6dbc8476","_id":"esvalid@1.1.0","_shasum":"2884d35ad31867dc144c32fe6c6a27fb08cff855","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"michaelficarra","email":"npm@michael.ficarra.me"},"maintainers":[{"name":"constellation","email":"utatane.tea@gmail.com"},{"name":"michaelficarra","email":"npm@michael.ficarra.me"}],"dist":{"shasum":"2884d35ad31867dc144c32fe6c6a27fb08cff855","size":6947,"noattachment":false,"key":"/esvalid/-/esvalid-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/esvalid/download/esvalid-1.1.0.tgz"},"directories":{},"publish_time":1406132924659,"_cnpm_publish_time":1406132924659,"_hasShrinkwrap":false},"1.0.0":{"name":"esvalid","version":"1.0.0","description":"confirm that a SpiderMonkey format AST represents an ECMAScript program","main":"index","scripts":{"test":"make lint test"},"files":["index.js"],"repository":{"type":"git","url":"git@github.com:michaelficarra/esvalid.git"},"keywords":["esvalid","ECMAScript","ES262","SpiderMonkey","AST","validate","validator","valid"],"author":{"name":"Michael Ficarra"},"license":"3-Clause BSD","bugs":{"url":"https://github.com/michaelficarra/esvalid/issues"},"homepage":"https://github.com/michaelficarra/esvalid","dependencies":{"esutils":"^1.1.0","object-assign":"^0.3.1"},"devDependencies":{"async":"0.9.0","coffee-script":"1.7.1","colors":"0.6.2","commander":"2.2.0","eslint":"^0.6.2","esprima":"^1.2.2","express":"4.4.4","istanbul":"^0.2.11","lodash":"2.4.1","mkdirp":"0.5.0","mocha":"^1.20.1","optimist":"0.6.1","request":"2.36.0","underscore":"1.6.0","xyz":"^0.4.0"},"gitHead":"ead1878b6dd1f32b91affc0390625bfa3199afb8","_id":"esvalid@1.0.0","_shasum":"b338689952642e5e96be904d5d9420ef3ad9ca89","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"michaelficarra","email":"npm@michael.ficarra.me"},"maintainers":[{"name":"constellation","email":"utatane.tea@gmail.com"},{"name":"michaelficarra","email":"npm@michael.ficarra.me"}],"dist":{"shasum":"b338689952642e5e96be904d5d9420ef3ad9ca89","size":5841,"noattachment":false,"key":"/esvalid/-/esvalid-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/esvalid/download/esvalid-1.0.0.tgz"},"directories":{},"publish_time":1405095390910,"_cnpm_publish_time":1405095390910,"_hasShrinkwrap":false},"0.0.2":{"name":"esvalid","version":"0.0.2","description":"confirm that a SpiderMonkey format AST represents an ECMAScript program","main":"index","scripts":{"test":"make lint test"},"files":["index.js"],"repository":{"type":"git","url":"git@github.com:michaelficarra/esvalid.git"},"keywords":["esvalid","ECMAScript","ES262","SpiderMonkey","AST","validate","validator","valid"],"author":{"name":"Michael Ficarra"},"license":"3-Clause BSD","bugs":{"url":"https://github.com/michaelficarra/esvalid/issues"},"homepage":"https://github.com/michaelficarra/esvalid","dependencies":{"esutils":"^1.0.0"},"devDependencies":{"async":"0.9.0","coffee-script":"1.7.1","colors":"0.6.2","commander":"2.2.0","eslint":"^0.6.2","esprima":"^1.2.2","express":"4.4.4","istanbul":"^0.2.11","lodash":"2.4.1","mkdirp":"0.5.0","mocha":"^1.20.1","optimist":"0.6.1","request":"2.36.0","underscore":"1.6.0","xyz":"^0.3.0"},"gitHead":"ef5cb0b22839a75a44f6d5fd64fb0f39850b6d5c","_id":"esvalid@0.0.2","_shasum":"d79f32f134b790bb673982529b164db986877922","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"michaelficarra","email":"npm@michael.ficarra.me"},"maintainers":[{"name":"constellation","email":"utatane.tea@gmail.com"},{"name":"michaelficarra","email":"npm@michael.ficarra.me"}],"dist":{"shasum":"d79f32f134b790bb673982529b164db986877922","size":3597,"noattachment":false,"key":"/esvalid/-/esvalid-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/esvalid/download/esvalid-0.0.2.tgz"},"directories":{},"publish_time":1404098016491,"_cnpm_publish_time":1404098016491,"_hasShrinkwrap":false},"0.0.1":{"name":"esvalid","version":"0.0.1","description":"confirm that a SpiderMonkey format AST represents an ECMAScript program","main":"index","scripts":{"test":"make lint test"},"files":["index.js"],"repository":{"type":"git","url":"git@github.com:michaelficarra/esvalid.git"},"keywords":["esvalid","ECMAScript","ES262","SpiderMonkey","AST","validate","validator","valid"],"author":{"name":"Michael Ficarra"},"license":"3-Clause BSD","bugs":{"url":"https://github.com/michaelficarra/esvalid/issues"},"homepage":"https://github.com/michaelficarra/esvalid","dependencies":{"esutils":"^1.0.0"},"devDependencies":{"async":"0.9.0","coffee-script":"1.7.1","colors":"0.6.2","commander":"2.2.0","eslint":"^0.6.2","esprima":"^1.2.2","express":"4.4.4","istanbul":"^0.2.11","lodash":"2.4.1","mkdirp":"0.5.0","mocha":"^1.20.1","optimist":"0.6.1","request":"2.36.0","underscore":"1.6.0","xyz":"^0.3.0"},"gitHead":"c5496c3311b1e6beffc670008b18282686a43cbb","_id":"esvalid@0.0.1","_shasum":"7530062ee4d022dd604999947300f39c6451759a","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"michaelficarra","email":"npm@michael.ficarra.me"},"maintainers":[{"name":"constellation","email":"utatane.tea@gmail.com"},{"name":"michaelficarra","email":"npm@michael.ficarra.me"}],"dist":{"shasum":"7530062ee4d022dd604999947300f39c6451759a","size":3005,"noattachment":false,"key":"/esvalid/-/esvalid-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/esvalid/download/esvalid-0.0.1.tgz"},"directories":{},"publish_time":1403518686903,"_cnpm_publish_time":1403518686903,"_hasShrinkwrap":false}},"readme":"# esvalid\n\n## Install\n\n    npm install esvalid\n\n## Usage\n\n#### `esvalid.isValid(node)` :: Spidermonkey AST Node → Boolean\n\nReturns true if and only if the given AST node represents a valid ECMAScript\nprogram.\n\n#### `esvalid.isValidExpression(node)` :: Spidermonkey AST Node → Boolean\n\nReturns true if and only if the given AST node represents a valid ECMAScript\nexpression.\n\n#### `esvalid.errors(node)` :: Spidermonkey AST Node → [InvalidAstError]\n\nReturns an array of `InvalidAstError` objects representing the errors in the\ngiven AST. An effort is made to continue collecting errors in the face of\nmalformed ASTs. If an empty array is returned, it is implied that the given AST\nnode is error free.\n\n#### `new esvalid.InvalidAstError(node, message)` :: Node -> String -> InvalidAstError\n\nConstructs a new `InvalidAstError` instance. `node` must be non-null.\n\n##### Example\n\n```\nvar esvalid = require(\"esvalid\");\nvar esprima = require(\"esprima\");\n\nvar program = esprima.parse(fs.readFileSync(require.resolve(\"esprima\")));\nesvalid.isValid(program); // true\n\nesvalid.isValid({type: \"Program\", body: []}); // true\nesvalid.isValid({type: \"Program\", body: null}); // false\n\nesvalid.isValidExpression({type: \"Program\", body: []}); // false\nesvalid.isValidExpression({type: \"Literal\", value: 0}); // true\n\nesvalid.errors({type: \"Program\", body: []}); // []\nvar error = esvalid.errors({type: \"Program\", body: null})[0];\nerror instanceof esvalid.InvalidAstError; // true\nerror.node; // {type: \"Program\", body: null}\nerror.message; // \"Program `body` member must be non-null\"\n```\n\n## Validity Tests\n\nThis is a list of all esvalid validity tests other than `null` tests and type checks.\n\n* BreakStatement must have an IterationStatement or SwitchStatement as an ancestor\n* labelled BreakStatement must have a matching LabeledStatement ancestor\n* ContinueStatement must have an IterationStatement as an ancestor\n* labelled ContinueStatement must have a matching LabeledStatement ancestor\n* Identifier `name` member must be a valid IdentifierName\n* Identifier `name` member must not be a ReservedWord\n* IfStatement with null `alternate` must not be the `consequent` of an IfStatement with a non-null `alternate`\n* LabeledStatement must not be nested within a LabeledStatement with the same label\n* numeric Literal nodes must not be NaN\n* numeric Literal nodes must be non-negative\n* numeric Literal nodes must be finite\n* static MemberExpression `property` member must have a valid IdentifierName `name` member\n* ObjectExpression getter property `value` member must have zero parameters\n* ObjectExpression setter property `value` member must have exactly one parameter\n* ObjectExpression must not have more than one data property with the same name in strict mode\n* ObjectExpression must not have data and getter properties with the same name\n* ObjectExpression must not have data and setter properties with the same name\n* ObjectExpression must not have data and getter properties with the same name\n* ObjectExpression must not have multiple getters with the same name\n* ObjectExpression must not have data and setter properties with the same name\n* ObjectExpression must not have multiple setters with the same name\n* ReturnStatement must be nested within a FunctionExpression or FunctionDeclaration node\n* SequenceExpression `expressions` member length must be >= 2\n* SwitchStatement `cases` member must contain no more than one SwitchCase with a null `test` member\n* TryStatement must have a non-null `handler` member or a non-null `finalizer` member\n* `delete` with unqualified identifier not allowed in strict mode\n* VariableDeclaration `declarations` member must be non-empty\n* WithStatement not allowed in strict mode\n","_attachments":{},"homepage":"https://github.com/michaelficarra/esvalid","bugs":{"url":"https://github.com/michaelficarra/esvalid/issues"},"license":"3-Clause BSD"}