{"_id":"events-to-array","_rev":"288370","name":"events-to-array","description":"Put a bunch of emitted events in an array, for testing.","dist-tags":{"latest":"2.0.3"},"maintainers":[{"name":"isaacs","email":""}],"time":{"modified":"2023-10-06T06:19:03.000Z","created":"2015-03-02T21:48:24.658Z","2.0.3":"2022-11-10T20:00:35.680Z","2.0.2":"2022-11-10T19:58:29.770Z","2.0.1":"2022-11-10T19:55:10.805Z","2.0.0":"2022-11-10T19:41:26.875Z","1.1.2":"2017-04-10T18:28:46.586Z","1.0.2":"2015-03-12T00:57:10.137Z","1.0.1":"2015-03-02T21:49:28.356Z","1.0.0":"2015-03-02T21:48:24.658Z"},"users":{},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"repository":{"type":"git","url":"git+https://github.com/isaacs/events-to-array.git"},"versions":{"2.0.3":{"name":"events-to-array","version":"2.0.3","description":"Put a bunch of emitted events in an array, for testing.","main":"index.js","engines":{"node":">=12"},"devDependencies":{"@types/node":"^18.11.9","tap":"^16.3.0"},"scripts":{"test":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"repository":{"type":"git","url":"git+https://github.com/isaacs/events-to-array.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","types":"./index.d.ts","gitHead":"cf09edf8a65edb9a9c7ec88dbe1c7ef82b029bff","_id":"events-to-array@2.0.3","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"0cd5ee538baae3ea9ec07539d778a2a6056699bc","size":2387,"noattachment":false,"key":"/events-to-array/-/events-to-array-2.0.3.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-2.0.3.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/events-to-array_2.0.3_1668110435525_0.33233684747605574"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-10T20:01:04.443Z","publish_time":1668110435680,"_cnpm_publish_time":1668110435680},"2.0.2":{"name":"events-to-array","version":"2.0.2","description":"Put a bunch of emitted events in an array, for testing.","main":"etoa.js","engines":{"node":">=12"},"devDependencies":{"@types/node":"^18.11.9","tap":"^16.3.0"},"scripts":{"test":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"repository":{"type":"git","url":"git+https://github.com/isaacs/events-to-array.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","gitHead":"f699e37db4d436a52ef6c108824264182c3a8812","_id":"events-to-array@2.0.2","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"c900132d417e6a65d9473fcc37748e8e9ecb31b2","size":2388,"noattachment":false,"key":"/events-to-array/-/events-to-array-2.0.2.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-2.0.2.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/events-to-array_2.0.2_1668110309602_0.4580083863282318"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-10T19:58:39.410Z","publish_time":1668110309770,"_cnpm_publish_time":1668110309770},"2.0.1":{"name":"events-to-array","version":"2.0.1","description":"Put a bunch of emitted events in an array, for testing.","main":"etoa.js","engines":{"node":">=12"},"devDependencies":{"@types/node":"^18.11.9","tap":"^16.3.0"},"scripts":{"test":"tap --100","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --all; git push origin --tags"},"repository":{"type":"git","url":"git+https://github.com/isaacs/events-to-array.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","gitHead":"cd883eb2a3cd97ab708d78ad115acabf860e3895","_id":"events-to-array@2.0.1","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"e48e3feb44554fc8eaab02ac9cb0d00f9b6611a5","size":2229,"noattachment":false,"key":"/events-to-array/-/events-to-array-2.0.1.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-2.0.1.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/events-to-array_2.0.1_1668110110616_0.9500993547744085"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-10T19:55:14.357Z","publish_time":1668110110805,"_cnpm_publish_time":1668110110805},"2.0.0":{"name":"events-to-array","version":"2.0.0","description":"Put a bunch of emitted events in an array, for testing.","main":"etoa.js","engines":{"node":">=12"},"devDependencies":{"tap":"^16.3.0"},"scripts":{"test":"tap --100","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --all; git push origin --tags"},"repository":{"type":"git","url":"git+https://github.com/isaacs/events-to-array.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","gitHead":"d2426eff0ae2fe2d3fe4e7f7875fd7f8cac3e7ac","_id":"events-to-array@2.0.0","_nodeVersion":"18.12.0","_npmVersion":"8.19.2","dist":{"shasum":"4f61a9a8392e684b04165a200ce61b83b91291bc","size":2212,"noattachment":false,"key":"/events-to-array/-/events-to-array-2.0.0.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-2.0.0.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/events-to-array_2.0.0_1668109286723_0.34586042625054225"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-10T19:43:07.033Z","publish_time":1668109286875,"_cnpm_publish_time":1668109286875},"1.1.2":{"name":"events-to-array","version":"1.1.2","description":"Put a bunch of emitted events in an array, for testing.","main":"etoa.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"^10.3.2"},"scripts":{"test":"tap test/*.js --100","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --all; git push origin --tags"},"repository":{"type":"git","url":"git+https://github.com/isaacs/events-to-array.git"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","gitHead":"00039bdbfed0505824a5756f9fb2b8827be62702","_id":"events-to-array@1.1.2","_shasum":"2d41f563e1fe400ed4962fe1a4d5c6a7539df7f6","_from":".","_npmVersion":"4.5.0","_nodeVersion":"8.0.0-pre","_npmUser":{"name":"isaacs","email":"i@izs.me"},"dist":{"shasum":"2d41f563e1fe400ed4962fe1a4d5c6a7539df7f6","size":16408,"noattachment":false,"key":"/events-to-array/-/events-to-array-1.1.2.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-1.1.2.tgz"},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/events-to-array-1.1.2.tgz_1491848924731_0.5634824349544942"},"publish_time":1491848926586,"_cnpm_publish_time":1491848926586,"_hasShrinkwrap":false},"1.0.2":{"name":"events-to-array","version":"1.0.2","description":"Put a bunch of emitted events in an array, for testing.","main":"etoa.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"^0.7.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/isaacs/events-to-array"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","gitHead":"2e6d5cd3cc1b7452b488ac1b0c6215715eb46dc4","_id":"events-to-array@1.0.2","_shasum":"b3484465534fe4ff66fbdd1a83b777713ba404aa","_from":".","_npmVersion":"2.7.1","_nodeVersion":"1.4.2","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"dist":{"shasum":"b3484465534fe4ff66fbdd1a83b777713ba404aa","size":2168,"noattachment":false,"key":"/events-to-array/-/events-to-array-1.0.2.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-1.0.2.tgz"},"publish_time":1426121830137,"_cnpm_publish_time":1426121830137,"_hasShrinkwrap":false},"1.0.1":{"name":"events-to-array","version":"1.0.1","description":"Put a bunch of emitted events in an array, for testing.","main":"etoa.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"^0.7.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/isaacs/events-to-array"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","gitHead":"4864f122729c5e8229949680f7cf2d31699b8f3b","_id":"events-to-array@1.0.1","_shasum":"fa83df1165fe761164ca03d25a4f4e23adce6175","_from":".","_npmVersion":"2.6.0","_nodeVersion":"1.4.2","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"dist":{"shasum":"fa83df1165fe761164ca03d25a4f4e23adce6175","size":1879,"noattachment":false,"key":"/events-to-array/-/events-to-array-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-1.0.1.tgz"},"publish_time":1425332968356,"_cnpm_publish_time":1425332968356,"_hasShrinkwrap":false},"1.0.0":{"name":"events-to-array","version":"1.0.0","description":"Put a bunch of emitted events in an array, for testing.","main":"etoa.js","directories":{"test":"test"},"dependencies":{},"devDependencies":{"tap":"^0.7.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/isaacs/events-to-array"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"homepage":"https://github.com/isaacs/events-to-array","gitHead":"8ebc98fc4bee7b6c96117a20b3a82a4f74cfe736","_id":"events-to-array@1.0.0","_shasum":"c30737c98e4ed4aa8b246cceab1c18f49e212f26","_from":".","_npmVersion":"2.6.0","_nodeVersion":"1.4.2","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"dist":{"shasum":"c30737c98e4ed4aa8b246cceab1c18f49e212f26","size":1841,"noattachment":false,"key":"/events-to-array/-/events-to-array-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/events-to-array/download/events-to-array-1.0.0.tgz"},"publish_time":1425332904658,"_cnpm_publish_time":1425332904658,"_hasShrinkwrap":false}},"readme":"# events-to-array\n\nPut a bunch of emitted events in an array, for testing.\n\nIf any of the emitted arguments are event emitters, then they'll also\nbe tracked, and replaced in the array with their tracking array.\n(This is less confusing in practice than it sounds in text, see\nbelow.)  The only caveat is that the events in the child event emitter\nand in the parent are not preserved in order, so this lib doesn't tell\nyou whether the child events happened before or after any subsequent\nparent events.\n\n## USAGE\n\n```\nvar assert = require('assert')\nvar EE = require('events')\nvar etoa = require('events-to-array')\nvar emitter = new EE()\nvar array = etoa(emitter)\n\nemitter.emit('foo', 1, 2, 3)\nemitter.emit('bar', { x: 1 })\n\n// nested events get tracked as well\nvar subemit = new EE()\nemitter.emit('sub', subemit)\nsubemit.emit('childEvent', { some: 'data' })\nsubemit.emit('anotherone', { some: 'data' }, 'many', 'args')\n\n// CAVEAT!  See above in the wordy part of this readme.\n// Note that the blaz/blorrg event comes after the child, and there's\n// no way to know that the child 'order not preserved' event happened\n// after.\nemitter.emit('blaz', 'blorrg')\nsubemit.emit('order', 'not', 'preserved between child and parent')\n\n// check out the array whenever\nassert.deepEqual(array,\n[ [ 'foo', 1, 2, 3 ],\n  [ 'bar', { x: 1 } ],\n  [ 'sub',\n    [ [ 'childEvent', { some: 'data' } ],\n      [ 'anotherone', { some: 'data' }, 'many', 'args' ],\n      [ 'order', 'not', 'preserved between child and parent' ] ] ],\n  [ 'blaz', 'blorrg' ] ])\n```\n\n## `eventsToArray(emitter, [ignoreList], [mapFunction])`\n\nReturns an array with all the events emitted by the emitter.\n\nIt's your responsibility to know when to check it for the events that\nyou expected to have received.\n\nThe `ignoreList` is an array of event names to ignore.\n\nThe `mapFunction` is a function that takes a list of arguments and\nreturns a potentially-mutated array of arguments.  Note that child\nevent emitters will already have been swapped out for an\nevents-to-array list so that nested events are caught.\n\nThis is handy, for example, for swapping out large `Buffer` objects\nwith something like `{type: 'buffer', length: 123456}` rather than\nblow up the JSON fixtures.\n\nThe map function is called on the args list as `map(arg, index, list)`\n","_attachments":{},"homepage":"https://github.com/isaacs/events-to-array","bugs":{"url":"https://github.com/isaacs/events-to-array/issues"},"license":"ISC"}