{"_id":"token-stream","_rev":"13-15a4d917e5e87c942eefbdccd9aa1f24","name":"token-stream","description":"Take an array of token and produce a more useful API to give to a parser","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"token-stream","version":"0.0.1","description":"Take an array of token and produce a more useful API to give to a parser","dependencies":{},"devDependencies":{"istanbul":"^0.3.2"},"scripts":{"test":"node test && npm run coverage","coverage":"istanbul cover test"},"repository":{"type":"git","url":"https://github.com/jadejs/token-stream.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","gitHead":"f41daf0266e179dd3570f1256ad683ce9cf6a235","bugs":{"url":"https://github.com/jadejs/token-stream/issues"},"homepage":"https://github.com/jadejs/token-stream","_id":"token-stream@0.0.1","_shasum":"ceeefc717a76c4316f126d0b9dbaa55d7e7df01a","_from":".","_npmVersion":"1.5.0-alpha-4","_npmUser":{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"}],"dist":{"shasum":"ceeefc717a76c4316f126d0b9dbaa55d7e7df01a","tarball":"https://registry.npmjs.org/token-stream/-/token-stream-0.0.1.tgz","integrity":"sha512-nfjOAu/zAWmX9tgwi5NRp7O7zTDUD1miHiB40klUnAh9qnL1iXdgzcz/i5dMaL5jahcBAaSfmNOBBJBLJW8TEg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHVTWICV18FKeTPPzRM+vS3PEiiVh4f8h03z4mObaQt1AiA2507uX+vYLkA6oX6Ic60mgJhFCZwP/TX+Pz/ZnBd63A=="}]},"directories":{}},"1.0.0":{"name":"token-stream","version":"1.0.0","description":"Take an array of token and produce a more useful API to give to a parser","dependencies":{},"devDependencies":{"istanbul":"*"},"scripts":{"test":"node test && npm run coverage","coverage":"istanbul cover test"},"repository":{"type":"git","url":"git+https://github.com/pugjs/token-stream.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","gitHead":"a0a9100a450c5e0db9ead52cdd4455da376d8ce5","bugs":{"url":"https://github.com/pugjs/token-stream/issues"},"homepage":"https://github.com/pugjs/token-stream#readme","_id":"token-stream@1.0.0","_shasum":"cc200eab2613f4166d27ff9afc7ca56d49df6eb4","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"timothygu","email":"timothygu99@gmail.com"},"dist":{"shasum":"cc200eab2613f4166d27ff9afc7ca56d49df6eb4","tarball":"https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz","integrity":"sha512-VSsyNPPW74RpHwR8Fc21uubwHY7wMDeJLys2IX5zJNih+OnAnaifKHo+1LHT7DAdloQ7apeaaWg8l7qnf/TnEg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChty8rAWtWG3V++BnDgTuAo7++AaVJ5Kl1jdRRaQlTnAiEAtXJkKPd/L0kK3EONCcm16Agg8efvsSKOHGb8E63Z9ro="}]},"maintainers":[{"name":"alubbe","email":"npm@lubbe.org"},{"name":"bloodyowl","email":"mlbli@me.com"},{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"jbnicolai","email":"jappelman@xebia.com"},{"name":"timothygu","email":"timothygu99@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/token-stream-1.0.0.tgz_1464759272310_0.31107465783134103"},"directories":{}}},"readme":"# token-stream\n\nTake an array of token and produce a more useful API to give to a parser.\n\n[![Build Status](https://img.shields.io/travis/pugjs/token-stream/master.svg)](https://travis-ci.org/pugjs/token-stream)\n[![Dependency Status](https://img.shields.io/david/pugjs/token-stream.svg)](https://david-dm.org/pugjs/token-stream)\n[![NPM version](https://img.shields.io/npm/v/token-stream.svg)](https://www.npmjs.org/package/token-stream)\n\n## Installation\n\n npm install token-stream\n\n## Usage\n\n```js\nvar TokenStream = require('token-stream');\n\nvar stream = new TokenStream([\n 'a',\n 'b',\n 'c',\n 'd'\n]);\nassert(stream.peek() === 'a');\nassert(stream.lookahead(0) == 'a');\nassert(stream.lookahead(1) == 'b');\n\nassert(stream.advance() === 'a');\nassert(stream.peek() === 'b');\nassert(stream.lookahead(0) == 'b');\nassert(stream.lookahead(1) == 'c');\n\nstream.defer('z');\nassert(stream.peek() === 'z');\nassert(stream.lookahead(0) == 'z');\nassert(stream.lookahead(1) == 'b');\nassert(stream.advance() === 'z');\nassert(stream.advance() === 'b');\nassert(stream.advance() === 'c');\nassert(stream.advance() === 'd');\n\n// an error is thrown if you try and advance beyond the end of the stream\nassert.throws(function () {\n stream.advance();\n});\n```\n\n## API\n\n### stream.peek()\n\nGets and returns the next item in the stream without advancing the stream's position.\n\n### stream.advance()\n\nReturns the next item in the stream and advances the stream by one item.\n\n### stream.defer(token)\n\nPut a token on the start of the stream (useful if you need to back track after calling advance).\n\n### stream.lookahead(index)\n\nReturn the item at `index` position from the start of the stream, but don't advance the stream. `stream.lookahead(0)` is equivalent to `stream.peek()`.\n\n## License\n\n MIT\n","maintainers":[{"email":"forbes@lindesay.co.uk","name":"forbeslindesay"},{"email":"timothygu99@gmail.com","name":"timothygu"}],"time":{"modified":"2023-12-15T12:05:26.110Z","created":"2014-11-20T13:28:14.796Z","0.0.1":"2014-11-20T13:28:14.796Z","1.0.0":"2016-06-01T05:34:32.722Z"},"homepage":"https://github.com/pugjs/token-stream#readme","repository":{"type":"git","url":"git+https://github.com/pugjs/token-stream.git"},"author":{"name":"ForbesLindesay"},"bugs":{"url":"https://github.com/pugjs/token-stream/issues"},"license":"MIT","readmeFilename":"README.md","users":{"robinblomberg":true}}