{"_id":"buster-syntax","_rev":"941475","name":"buster-syntax","description":"[![Build status](https://secure.travis-ci.org/busterjs/buster-syntax.png?branch=master)](http://travis-ci.org/busterjs/buster-syntax)","dist-tags":{"latest":"0.5.0"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"time":{"modified":"2021-09-23T02:07:49.000Z","created":"2012-02-16T19:47:30.386Z","0.5.0":"2015-11-29T15:31:44.511Z","0.4.3":"2014-06-06T14:36:15.767Z","0.4.2":"2012-07-09T22:26:43.798Z","0.4.0":"2012-06-20T21:51:10.538Z","0.2.0":"2012-04-17T21:36:55.854Z","0.1.1":"2012-03-03T22:29:17.432Z","0.1.0":"2012-02-16T19:47:30.386Z"},"users":{},"author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"repository":{"type":"git","url":"git+https://github.com/busterjs/buster-syntax.git"},"versions":{"0.5.0":{"name":"buster-syntax","version":"0.5.0","description":"[![Build status](https://secure.travis-ci.org/busterjs/buster-syntax.png?branch=master)](http://travis-ci.org/busterjs/buster-syntax)","homepage":"http://busterjs.org/docs/syntax","author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"contributors":[{"name":"Stein Magnus Jodal","email":"stein.magnus@jodal.no","url":"http://jodal.no"}],"license":"BSD-3-Clause","main":"./lib/buster-syntax","repository":{"type":"git","url":"git+https://github.com/busterjs/buster-syntax.git"},"scripts":{"test":"node run-tests.js","test-debug":"node --debug-brk run-tests.js"},"engines":{"node":">= 4"},"dependencies":{"uglify-js":"2.x"},"devDependencies":{"sinon":"1.x","referee":"1.x","buster-test":"0.7.x","buster-analyzer":"0.6.x","buster-configuration":"0.8.x"},"gitHead":"90500e817c7378b0d0e3dbd89f2e56646e2c8d53","bugs":{"url":"https://github.com/busterjs/buster-syntax/issues"},"_id":"buster-syntax@0.5.0","_shasum":"abfa4609f2581899ea74274b26b36721da1876d1","_from":".","_npmVersion":"3.4.1","_nodeVersion":"4.2.2","_npmUser":{"name":"dominykas","email":"hello@dominykas.com"},"dist":{"shasum":"abfa4609f2581899ea74274b26b36721da1876d1","size":5677,"noattachment":false,"key":"/buster-syntax/-/buster-syntax-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buster-syntax/download/buster-syntax-0.5.0.tgz"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"directories":{},"publish_time":1448811104511,"_cnpm_publish_time":1448811104511,"_hasShrinkwrap":false,"deprecated":"No longer maintained"},"0.4.3":{"name":"buster-syntax","version":"0.4.3","description":"[![Build status](https://secure.travis-ci.org/busterjs/buster-syntax.png?branch=master)](http://travis-ci.org/busterjs/buster-syntax)","homepage":"http://busterjs.org/docs/syntax","author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"contributors":[{"name":"Stein Magnus Jodal","email":"stein.magnus@jodal.no","url":"http://jodal.no"}],"main":"./lib/buster-syntax","repository":{"type":"git","url":"https://github.com/busterjs/buster-syntax.git"},"scripts":{"test":"node run-tests.js","test-debug":"node --debug-brk run-tests.js"},"dependencies":{"uglify-js":"~1.2.5","jsdom":"~0.10"},"optionalDependencies":{"jsdom":"~0.10"},"devDependencies":{"sinon":"*","referee":"*","buster-test":"*","buster-analyzer":">=0.4","buster-configuration":">=0.6.0"},"bugs":{"url":"https://github.com/busterjs/buster-syntax/issues"},"_id":"buster-syntax@0.4.3","_shasum":"ae42514e0eac83d89075a706a7e5bb900570b073","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"dwittner","email":"d.wittner@gmx.de"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"dist":{"shasum":"ae42514e0eac83d89075a706a7e5bb900570b073","size":5726,"noattachment":false,"key":"/buster-syntax/-/buster-syntax-0.4.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/buster-syntax/download/buster-syntax-0.4.3.tgz"},"directories":{},"publish_time":1402065375767,"_cnpm_publish_time":1402065375767,"_hasShrinkwrap":false,"deprecated":"No longer maintained"},"0.4.2":{"name":"buster-syntax","version":"0.4.2","description":"","homepage":"http://busterjs.org/docs/buster-syntax","author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"contributors":[{"name":"August Lilleaas","email":"august.lilleaas@gmail.com","url":"http://augustl.com"}],"main":"./lib/buster-syntax","repository":{"type":"git","url":"git://github.com/busterjs/buster-syntax.git"},"scripts":{"test":"./node_modules/buster/bin/buster-test"},"dependencies":{"uglify-js":"~1.2.5"},"optionalDependencies":{"jsdom":"~0.2.14"},"devDependencies":{"buster":"*","buster-analyzer":">=0.3","buster-configuration":">=0.5.0"},"_npmUser":{"name":"cjohansen","email":"christian@cjohansen.no"},"_id":"buster-syntax@0.4.2","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-alpha-6","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"b2e15fd5a6fa771ea5d22936e39274486cbb96fb","size":3414,"noattachment":false,"key":"/buster-syntax/-/buster-syntax-0.4.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/buster-syntax/download/buster-syntax-0.4.2.tgz"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"directories":{},"publish_time":1341872803798,"_cnpm_publish_time":1341872803798,"_hasShrinkwrap":false,"deprecated":"No longer maintained"},"0.4.0":{"name":"buster-syntax","version":"0.4.0","description":"","homepage":"http://busterjs.org/docs/buster-syntax","author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"contributors":[{"name":"August Lilleaas","email":"august.lilleaas@gmail.com","url":"http://augustl.com"}],"main":"./lib/buster-syntax","repository":{"type":"git","url":"git://github.com/busterjs/buster-syntax.git"},"scripts":{"test":"./node_modules/buster/bin/buster-test"},"dependencies":{"uglify-js":"~1.2.5"},"optionalDependencies":{"jsdom":"~0.2.14"},"devDependencies":{"buster":"*","buster-analyzer":">=0.3","buster-configuration":">=0.5.0"},"_npmUser":{"name":"cjohansen","email":"christian@cjohansen.no"},"_id":"buster-syntax@0.4.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-alpha-6","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"24e925e7c28761ed60247d764a8c84ff0ebb5c14","size":3409,"noattachment":false,"key":"/buster-syntax/-/buster-syntax-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buster-syntax/download/buster-syntax-0.4.0.tgz"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"directories":{},"publish_time":1340229070538,"_cnpm_publish_time":1340229070538,"_hasShrinkwrap":false,"deprecated":"No longer maintained"},"0.2.0":{"name":"buster-syntax","version":"0.2.0","description":"","homepage":"http://busterjs.org/docs/buster-syntax","author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"contributors":[{"name":"August Lilleaas","email":"august.lilleaas@gmail.com","url":"http://augustl.com"}],"main":"./lib/buster-syntax","repository":{"type":"git","url":"git://github.com/busterjs/buster-syntax.git"},"dependencies":{"uglify-js":"~1.2.5"},"optionalDependencies":{"jsdom":"~0.2.14"},"devDependencies":{"buster":"*","buster-analyzer":">=0.1","buster-configuration":">=0.3"},"_npmUser":{"name":"cjohansen","email":"christian@cjohansen.no"},"_id":"buster-syntax@0.2.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-alpha-6","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"6f6d729f340c26a209948e16f79e418941ddd1c8","size":3199,"noattachment":false,"key":"/buster-syntax/-/buster-syntax-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buster-syntax/download/buster-syntax-0.2.0.tgz"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"directories":{},"publish_time":1334698615854,"_cnpm_publish_time":1334698615854,"_hasShrinkwrap":false,"deprecated":"No longer maintained"},"0.1.1":{"name":"buster-syntax","version":"0.1.1","description":"","homepage":"http://busterjs.org/docs/buster-syntax","author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"contributors":[{"name":"August Lilleaas","email":"august.lilleaas@gmail.com","url":"http://augustl.com"}],"main":"./lib/buster-syntax","repository":{"type":"git","url":"git://github.com/busterjs/buster-syntax.git"},"dependencies":{"uglify-js":"~1.2.5"},"optionalDependencies":{"jsdom":"~0.2.10"},"devDependencies":{"buster":"*","buster-analyzer":">=0.1","buster-configuration":">=0.3"},"_npmUser":{"name":"cjohansen","email":"christian@cjohansen.no"},"_id":"buster-syntax@0.1.1","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-alpha-6","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"eb102d13dc299676b87d30d40fe9479c318c667c","size":3296,"noattachment":false,"key":"/buster-syntax/-/buster-syntax-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/buster-syntax/download/buster-syntax-0.1.1.tgz"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"directories":{},"publish_time":1330813757432,"_cnpm_publish_time":1330813757432,"_hasShrinkwrap":false,"deprecated":"No longer maintained"},"0.1.0":{"name":"buster-syntax","version":"0.1.0","description":"","homepage":"http://busterjs.org/docs/buster-syntax","author":{"name":"Christian Johansen","email":"christian@cjohansen.no","url":"http://cjohansen.no"},"contributors":[{"name":"August Lilleaas","email":"august.lilleaas@gmail.com","url":"http://augustl.com"}],"main":"./lib/buster-syntax","repository":{"type":"git","url":"git://github.com/busterjs/buster-syntax.git"},"dependencies":{"jsdom":"~0.2.10","uglify-js":"~1.2.5"},"devDependencies":{"buster":"*","buster-analyzer":">=0.1","buster-configuration":">=0.3"},"_npmUser":{"name":"cjohansen","email":"christian@cjohansen.no"},"_id":"buster-syntax@0.1.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.0-alpha-6","_nodeVersion":"v0.6.5","_defaultsLoaded":true,"dist":{"shasum":"142e49e106ca1efb78001e5fb66c8cbeea9dc88a","size":3235,"noattachment":false,"key":"/buster-syntax/-/buster-syntax-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buster-syntax/download/buster-syntax-0.1.0.tgz"},"maintainers":[{"name":"augustl","email":"august@augustl.com"},{"name":"dominykas","email":"hello@dominykas.com"},{"name":"dwittner","email":"d.wittner@gmx.de"}],"directories":{},"publish_time":1329421650386,"_cnpm_publish_time":1329421650386,"_hasShrinkwrap":false,"deprecated":"No longer maintained"}},"readme":"# buster-syntax\n\n[![Build status](https://secure.travis-ci.org/busterjs/buster-syntax.png?branch=master)](http://travis-ci.org/busterjs/buster-syntax)\n\n> Stop syntax errors before they hit the browser\n\n`buster-syntax` is an API for syntax checking JavaScript in Node.JS. It also\nprovides a Buster.JS extension that syntax checks files on the server before\nrunning them in the browser (over `ramp`).\n\nCatching errors early with Buster.JS test runs has one primary goal: Avoid\nbrowsers with poor error handling freezing if a test run contains lots of\nerrors. As a pleasant side-effect, you get consistent and detailed syntax\nerrors, regardless of target browser.\n\nThis extension ships with Buster.JS by default, so there's nothing to do to\nenable it. If you want to do test runs in the browser without this extension,\nyou have to provide your own runner plumbing, see `buster docs\n<http://github.com/busterjs/buster/>`_ for information on how.\n\n\n## API Docs\n\nTo syntax check some JavaScript, require the module and call its `check`\nmethod. It returns an object with details about the validity.\n\n\n### `check(script[, file])`\n\nSyntax check the code with the optional file name. The file name is used to\ncreate nice error messages.\n\n```javascript\nvar syntax = require(\"buster-syntax\").syntax;\n\n// Syntactically valid\nsyntax.check(\"var a = 42;\"); // => { ok: true }\n\n// Syntactically invalid\nsyntax.check(\"var a 42;\"); // => {\n  ok: false,\n  errors:\n    [ { file: null,\n        type: 'Syntax error',\n        message: 'Unexpected token: num (42)',\n        line: 1,\n        col: 7,\n        content: 'var a 42;' } ] }\n\n\n// Syntactically invalid, with file name\nsyntax.check(\"var a 42;\", \"life.js\"); // => {\n  ok: false,\n  errors:\n    [ { file: \"life.js\",\n        type: 'Syntax error',\n        message: 'Unexpected token: num (42)',\n        line: 1,\n        col: 7,\n        content: 'var a 42;' } ] }\n```        \n\n\n### `configure(options)`\n\nConfigures the syntax checker and returns a specialized instance (i.e., it does\nnot change the module instance). Currently only one configuration property is\nsupported: `ignoreReferenceErrors`. References typically require more than one\nfile to be viewed as one unit. If you just want to syntax check one file that\ncontains references to external identifiers, you can choose to not fail on those\nunknown references.\n\n```javascript\nvar syntax = require(\"buster-syntax\").syntax;\n\nsyntax.check(\"$('li').on('click', function() {})\"); // => {\n  ok: false,\n  errors:\n    [ { file: null,\n        type: 'Syntax error',\n        message: 'Unexpected token punc, expected punc',\n        line: 1,\n        col: 30,\n        content: '$(\\'li\\').on(\\'click\\', function {})' } ] }\n\nvar checker = syntax.configure({ ignoreReferenceErrors: true });\nchecker.check(\"$('li').on('click', function() {})\"); // => { ok: true }\n```\n\n\n## Changelog\n\n**0.5.0** (2015-Nov-29)\n\n* Updated all dependencies, incl. uglify to v2\n* Removed `jsdom`\n* Added supported engines (node 4+) flag in package.json\n\n**0.4.3** (2014-Jun-06)\n\n* JsDom updated to version ~0.10 for issue [#410 - Buster is modifying the global `Error` object (via old JSDOM)](https://github.com/busterjs/buster/issues/410)\n","_attachments":{},"homepage":"http://busterjs.org/docs/syntax","bugs":{"url":"https://github.com/busterjs/buster-syntax/issues"},"license":"BSD-3-Clause"}