{"_id":"a-bit-of","_rev":"11-4643fb8c325bbdc7ad54ccccaefcc349","name":"a-bit-of","description":"live-code with streaming data","dist-tags":{"latest":"2.0.4"},"versions":{"0.1.0":{"name":"a-bit-of","version":"0.1.0","description":"live-code with event emitters - processing / arduino style!","main":"indes.js","repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"keywords":["live code","livecode","event emitters","hot reload"],"author":{"name":"elsehow"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"homepage":"https://github.com/elsehow/a-bit-of#readme","dependencies":{"hotmop":"0.0.2","kefir":"^3.1.0"},"gitHead":"85b8f32eb4ec3ad29a156304237321311b63319a","_id":"a-bit-of@0.1.0","scripts":{},"_shasum":"d67a0396e70bd27dbf66fe5f7c24cdefb5e45ee1","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.0","_npmUser":{"name":"elsehow","email":"ffff@berkeley.edu"},"dist":{"shasum":"d67a0396e70bd27dbf66fe5f7c24cdefb5e45ee1","tarball":"https://registry.npmjs.org/a-bit-of/-/a-bit-of-0.1.0.tgz","integrity":"sha512-wZc6VXuc6HJ+L2cTmALsvpW6SyrZpXfoVVLb1Kf7t0G23owH8aiMjObYCaJo4YbfbsClEYLOhcLcuSkDTRZd6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFrSHFHyowKlcgrW4ryhu701ayxCZkRzoRYaSSbFtoInAiBGArydjMqkYboUZcmQWc1u8RfAGOklc7h2NkkxnQSq+A=="}]},"maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}]},"0.2.0":{"name":"a-bit-of","version":"0.2.0","description":"live-code with event emitters - processing / arduino style!","main":"indes.js","repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"keywords":["live code","livecode","event emitters","hot reload"],"author":{"name":"elsehow"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"homepage":"https://github.com/elsehow/a-bit-of#readme","dependencies":{"hotmop":"0.0.2"},"devDependencies":{"kefir":"^3.1.0"},"gitHead":"4e10bfda9a49b2cc6d75349cfc2304ff24dbef00","_id":"a-bit-of@0.2.0","scripts":{},"_shasum":"7f6fafcc053aaa35ac1b4316eb11ff6f0cabf9ed","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.0","_npmUser":{"name":"elsehow","email":"ffff@berkeley.edu"},"dist":{"shasum":"7f6fafcc053aaa35ac1b4316eb11ff6f0cabf9ed","tarball":"https://registry.npmjs.org/a-bit-of/-/a-bit-of-0.2.0.tgz","integrity":"sha512-c7plkfx9XS3P74A36oXm7Eihuu8T5wwVf/u/DArFyJjnt1AxXd5dAYZ63M5g7vsScr+s8dw43hpSXFE3vdrt1Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYykJYOZhV58QIt6pAo9CDm7gx3jiUDr30HZPkznZYzgIhAJsd1naJMeQdpdLH2RADzNe2H5Po5RhJt+EpPxlwNaqP"}]},"maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}]},"0.2.2":{"name":"a-bit-of","version":"0.2.2","description":"live-code with event emitters - processing / arduino style!","main":"indes.js","repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"keywords":["live code","livecode","event emitters","hot reload"],"author":{"name":"elsehow"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"homepage":"https://github.com/elsehow/a-bit-of#readme","dependencies":{"hotmop":"0.0.2"},"devDependencies":{"kefir":"^3.1.0"},"gitHead":"700331b1c4ec28514970c225194d8956a99a03aa","_id":"a-bit-of@0.2.2","scripts":{},"_shasum":"23a72b059685410056f8dbc0f5eb4b5daf089208","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.0","_npmUser":{"name":"elsehow","email":"ffff@berkeley.edu"},"dist":{"shasum":"23a72b059685410056f8dbc0f5eb4b5daf089208","tarball":"https://registry.npmjs.org/a-bit-of/-/a-bit-of-0.2.2.tgz","integrity":"sha512-a/l/Hpq9TRrGlUqU7OaBmgQCPguFmTcN99pxQi3Am5TW+i4v1UZvGN4oxkhP4ZGuAJpqE+0G1IHXiVcuf2kl+g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIED4GxCItCoHArVKhwwuetx9v0PM7DhQ3osT4jiMGAu2AiEAjmjPQGgRHMqSVSshtSNNlIcs3bRteZxFaRU2aDp4vgQ="}]},"maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}]},"2.0.0":{"name":"a-bit-of","version":"2.0.0","description":"live-code with streaming data","main":"index.js","scripts":{"test":"node test/test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"author":{"name":"elsehow"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"homepage":"https://github.com/elsehow/a-bit-of#readme","dependencies":{"tape":"^4.2.2"},"devDependencies":{"tap-spec":"^4.1.1"},"gitHead":"b49f884143fc1614c89914b34189eb71adc0d562","_id":"a-bit-of@2.0.0","_shasum":"16710a6fda18afd2edc8138b98538c1752ac6703","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.0","_npmUser":{"name":"elsehow","email":"ffff@berkeley.edu"},"dist":{"shasum":"16710a6fda18afd2edc8138b98538c1752ac6703","tarball":"https://registry.npmjs.org/a-bit-of/-/a-bit-of-2.0.0.tgz","integrity":"sha512-UaVItxzTcDvIxxIB7bOTVUcSU7OTOlrcR4IPEjTBz5Wxykxj5Iw8avLhCGvfIycgXPzHdrzMrMZ8fdT7iMNBtw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBpp8s8QANA8fD2y/pGDFWNBLrcuiER4/avsVcr4fBIBAiAydNU7Pu6SXb7OSfihg1V7wbyF0emY1UbDzbR2khqP7w=="}]},"maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}]},"2.0.1":{"name":"a-bit-of","version":"2.0.1","description":"live-code with streaming data","main":"index.js","scripts":{"test":"node test/test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"author":{"name":"elsehow"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"homepage":"https://github.com/elsehow/a-bit-of#readme","dependencies":{"kefir":"^3.1.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.2.2"},"gitHead":"b41fdf273e6ed38a8525644d767a60d337af7a57","_id":"a-bit-of@2.0.1","_shasum":"3e395a6634c51270ff07728d32217b9551e51655","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.0","_npmUser":{"name":"elsehow","email":"ffff@berkeley.edu"},"dist":{"shasum":"3e395a6634c51270ff07728d32217b9551e51655","tarball":"https://registry.npmjs.org/a-bit-of/-/a-bit-of-2.0.1.tgz","integrity":"sha512-2UmUwGII+R6VlRD2MhzJxm1G4y4EIofoOxlUQu82EARcTSemUh3qTJwlYnTJ4Pd7RMAy2qhARM7zY4L2yJ9haw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEcfnR5AnX/eAk7c8sIYjasiRnRNERup9mISOibrJFyVAiAR+njbmBQ9hiF0hxFxYpNSM8SXvlEWqkfG62kDx5BvYg=="}]},"maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}]},"2.0.3":{"name":"a-bit-of","version":"2.0.3","description":"live-code with streaming data","main":"index.js","scripts":{"test":"node test/test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"author":{"name":"elsehow"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"homepage":"https://github.com/elsehow/a-bit-of#readme","dependencies":{"kefir":"^3.1.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.2.2"},"gitHead":"0880230b8dc78037606914c2e49563f93e5c2f19","_id":"a-bit-of@2.0.3","_shasum":"cc8685f3e559992400697067d402ca6d8aca63ba","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"elsehow","email":"ffff@berkeley.edu"},"dist":{"shasum":"cc8685f3e559992400697067d402ca6d8aca63ba","tarball":"https://registry.npmjs.org/a-bit-of/-/a-bit-of-2.0.3.tgz","integrity":"sha512-oj/+Hv6skOrePBorFq2ClZ0hjaVF7IOEriLko/8U8THg7Clm9wWPhDntVKtdBrAuLK0Hqr/9JEUmvwkRlQMswg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmBejS5jenzd3zg3cN3e+bv2YOeY2wxNq3vTvtawb2hgIhAJ38Mj1KazBAnlnILAn9ogxiJ4StUigJCkefCbXFTxrG"}]},"maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}]},"2.0.4":{"name":"a-bit-of","version":"2.0.4","description":"live-code with streaming data","main":"index.js","scripts":{"test":"node test/test.js | tap-spec"},"repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"author":{"name":"elsehow"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"homepage":"https://github.com/elsehow/a-bit-of#readme","dependencies":{"kefir":"^3.1.0"},"devDependencies":{"tap-spec":"^4.1.1","tape":"^4.2.2"},"gitHead":"1321fd48077be60a0185ea47e99e4a6082790f39","_id":"a-bit-of@2.0.4","_shasum":"f35ff62820837cc3c5055310fc02ae03a8db2993","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.0","_npmUser":{"name":"elsehow","email":"ffff@berkeley.edu"},"dist":{"shasum":"f35ff62820837cc3c5055310fc02ae03a8db2993","tarball":"https://registry.npmjs.org/a-bit-of/-/a-bit-of-2.0.4.tgz","integrity":"sha512-oWHjPiIKiw5ZSYLs4aT3TwRleLUoyUbUoxCv89flBho0+JZheTWW67uArETyAoYfq7LZUeQZ7xR7/qLBGPgvnw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGGNwzl1YgUCWCsq9Iud8FHSZzSAUzJUrKTIX4tYmEt9AiBKp0NqHcDkRKzRuSJgYrXNFCFhHnXOBh7diGC03lYufg=="}]},"maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}]}},"readme":"# a bit of\n\na functional-reactive approach to flow-based programming\n\nmake chains of functions, a-la max/msp, puredata, vvvv, etc, to program with streaming sources of data\n\nupdate processing/output functions without disturbing your source streams.\n\n## components\n\ncomponents are attached together to process streams.\n\ncomponents are made out of a function. general pattern:\n\n```javascript\nvar c = new Component(e => \n  console.log('err', err)).update(myFunction)\n```\n\nthe component's consturctor takes an error callback. you can set the component's function by calling its `update` method.\n\nthere are three types of components:\n\n### origin\n\norigin's functions take nothing\n\nthey reutrn a list of [ [ emitter, 'event' ] ..]\n\n```javascript\nfunction originFn () {\n  // port is an EventEmitter\n  port = serialport('/dev/tty.MindWave')\n  socket = websocket('ws://some-server')\n  // we want to make a stream of its 'data' events\n  return [\n    [port, 'data'],\n    [socket, 'event'],\n  ]\n}\n\nvar o = new abitof.Origin(e => \n  console.log('err', e)).update(originFn)\n```\n\n### transform\n\ntransform function's take an arbitrary number of streams, and return a list of streams\n\n```javascript\nfunction transformFn (deviceStream, socketStream) {\n  // return a stream of fft'd buffers \n  return [\n    deviceStream.bufferWithCount(512).map(fft),\n    socketStream.filter(someFilterFn),\n  ]\n}\n\nvar t = new abitof.Transform(e => \n  console.log('err', e).update(trasnformFn)\n```\n\n\n### endpoints \n\nendpoint functions return a list of functions.\n\nthe functions handle values from inputs stream\n\n```javascript\nfunction endpointFn (fftStream) {\n  //  endpoints setup logic\n  midiServer.start()\n  // return handle(), and, optionally, a taredown () function\n  return [\n    function (x) { \n      midiServer.send(midiFromAlphaWaves(x));\n      midiServer.send(midiFromRoomEvents(x));\n    }\n  ]\n}\n\nvar e = new Endpoint (e => \n  console.log('err', e).update(endpointFn)\n```\n\noptionally, endpoint functions can return a `taredown()` method, which gets triggered when a new update() function is passed through\n\nuse it for, e.g., removing divs so that you can re-add them.\n\n```javascript\nfunction endpointFn (fftStream) {\n  //  endpoints setup logic\n  midiServer.start()\n  // return handle(), and, optionally, a taredown () function\n  return {\n    handlers: [\n      function (x) { \n        midiServer.send(midiFromAlphaWaves(x))\n      }\n    ],\n    // taredown\n    taredown: () => {\n      midiServer.stop()\n    }\n}\n```\n## attaching components together\n\n```javascript\nvar abitof = require('a-bit-of')\n\n// make components\nvar o = new abitof.Origin(someOriginFn)\nvar t = new abitof.Transform(someTransformFn)\nvar e = new abitof.Endpoint(someEndpointFn)\n\n// attach them together\no.attach(t).attach(e)\n```\n\n## api\n\n### origin\n\nupdate(originFn)\n\nattach(someDownstreamComponent)\n\n### transform\n\nupdate(transformFn)\n\nattach(someDownstreamComponent)\n\n## endpoint\n\nupdate(transformFn)\n\nNOTE: you can't attach anything to endpoints. nothing can be downstream from an endpoint.\n","maintainers":[{"name":"elsehow","email":"ffff@berkeley.edu"}],"time":{"modified":"2022-06-13T02:16:52.463Z","created":"2015-11-24T05:05:38.379Z","0.1.0":"2015-11-24T05:05:38.379Z","0.2.0":"2015-11-24T18:30:20.999Z","0.2.1":"2015-11-24T22:22:16.999Z","0.2.2":"2015-12-02T09:23:17.177Z","2.0.0":"2015-12-07T02:27:52.349Z","2.0.1":"2015-12-07T04:23:37.549Z","2.0.3":"2015-12-08T10:41:07.793Z","2.0.4":"2015-12-12T21:15:53.469Z"},"homepage":"https://github.com/elsehow/a-bit-of#readme","repository":{"type":"git","url":"git+https://github.com/elsehow/a-bit-of.git"},"author":{"name":"elsehow"},"bugs":{"url":"https://github.com/elsehow/a-bit-of/issues"},"license":"BSD-2-Clause","readmeFilename":"README.md"}