{ "_args": [ [ { "raw": "ee-first@1.1.1", "scope": null, "escapedName": "ee-first", "name": "ee-first", "rawSpec": "1.1.1", "spec": "1.1.1", "type": "version" }, "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/on-finished" ] ], "_from": "ee-first@1.1.1", "_id": "ee-first@1.1.1", "_inCache": true, "_location": "/ee-first", "_npmUser": { "name": "dougwilson", "email": "doug@somethingdoug.com" }, "_npmVersion": "1.4.28", "_phantomChildren": {}, "_requested": { "raw": "ee-first@1.1.1", "scope": null, "escapedName": "ee-first", "name": "ee-first", "rawSpec": "1.1.1", "spec": "1.1.1", "type": "version" }, "_requiredBy": [ "/on-finished" ], "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "_shasum": "590c61156b0ae2f4f0255732a158b266bc56b21d", "_shrinkwrap": null, "_spec": "ee-first@1.1.1", "_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/on-finished", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", "url": "http://jongleberry.com" }, "bugs": { "url": "https://github.com/jonathanong/ee-first/issues" }, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], "dependencies": {}, "description": "return the first event in a set of ee/event pairs", "devDependencies": { "istanbul": "0.3.9", "mocha": "2.2.5" }, "directories": {}, "dist": { "shasum": "590c61156b0ae2f4f0255732a158b266bc56b21d", "tarball": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz" }, "files": [ "index.js", "LICENSE" ], "gitHead": "512e0ce4cc3643f603708f965a97b61b1a9c0441", "homepage": "https://github.com/jonathanong/ee-first#readme", "license": "MIT", "maintainers": [ { "name": "jongleberry", "email": "jonathanrichardong@gmail.com" }, { "name": "dougwilson", "email": "doug@somethingdoug.com" } ], "name": "ee-first", "optionalDependencies": {}, "readme": "# EE First\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Gittip][gittip-image]][gittip-url]\n\nGet the first event in a set of event emitters and event pairs,\nthen clean up after itself.\n\n## Install\n\n```sh\n$ npm install ee-first\n```\n\n## API\n\n```js\nvar first = require('ee-first')\n```\n\n### first(arr, listener)\n\nInvoke `listener` on the first event from the list specified in `arr`. `arr` is\nan array of arrays, with each array in the format `[ee, ...event]`. `listener`\nwill be called only once, the first time any of the given events are emitted. If\n`error` is one of the listened events, then if that fires first, the `listener`\nwill be given the `err` argument.\n\nThe `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the\nfirst argument emitted from an `error` event, if applicable; `ee` is the event\nemitter that fired; `event` is the string event name that fired; and `args` is an\narray of the arguments that were emitted on the event.\n\n```js\nvar ee1 = new EventEmitter()\nvar ee2 = new EventEmitter()\n\nfirst([\n [ee1, 'close', 'end', 'error'],\n [ee2, 'error']\n], function (err, ee, event, args) {\n // listener invoked\n})\n```\n\n#### .cancel()\n\nThe group of listeners can be cancelled before being invoked and have all the event\nlisteners removed from the underlying event emitters.\n\n```js\nvar thunk = first([\n [ee1, 'close', 'end', 'error'],\n [ee2, 'error']\n], function (err, ee, event, args) {\n // listener invoked\n})\n\n// cancel and clean up\nthunk.cancel()\n```\n\n[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/ee-first\n[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square\n[github-url]: https://github.com/jonathanong/ee-first/tags\n[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square\n[travis-url]: https://travis-ci.org/jonathanong/ee-first\n[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master\n[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square\n[license-url]: LICENSE.md\n[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/ee-first\n[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square\n[gittip-url]: https://www.gittip.com/jonathanong/\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/jonathanong/ee-first.git" }, "scripts": { "test": "mocha --reporter spec --bail --check-leaks test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" }, "version": "1.1.1" }