{"name":"wonka","version":"3.0.0-2.beta","author":{"name":"Phil Pluckthun","email":"phil@kitten.sh"},"source":"./src/index.js","main":"./dist/wonka.js","module":"./dist/wonka.es.js","jsnext:main":"./dist/wonka.es.js","types":"./src/index.d.ts","scripts":{"clean":"bsb -clean-world","build":"bsb -make-world","watch":"bsb -make-world -w","test":"jest","coverage":"jest -c ./.jest.coverage.json --coverage","test:watch":"jest --watch","refmt":"bsrefmt --in-place **/**/*.{re,rei}","flowgen":"./scripts/generate-flow-files.js","bundle":"rollup -c rollup.config.js","prepublishOnly":"run-s clean build bundle flowgen test"},"keywords":["wonka","reason","bucklescript","callbag","callback","observable","iterable","stream"],"repository":{"type":"git","url":"https://github.com/kitten/wonka"},"homepage":"https://github.com/kitten/wonka","bugs":{"url":"https://github.com/kitten/wonka/issues"},"license":"MIT","dependencies":{},"devDependencies":{"@glennsl/bs-jest":"^0.4.8","bs-platform":"^5.0.4","flowgen":"^1.8.0","globby":"^9.2.0","husky":"^1.3.1","lint-staged":"^8.1.6","npm-run-all":"^4.1.5","prettier":"^1.17.0","rollup":"^1.11.3","rollup-plugin-buble":"^0.19.6","rollup-plugin-commonjs":"^9.3.4","rollup-plugin-node-resolve":"^4.2.3","rollup-plugin-prettier":"^0.6.0","rollup-plugin-terser":"^4.0.4"},"lint-staged":{"*.{d.ts,js}":["prettier --write","git add"],"*.{re,rei}":["bsrefmt --in-place","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"prettier":{"singleQuote":true,"printWidth":100},"jest":{"moduleFileExtensions":["js"],"testMatch":["**/lib/js/__tests__/*_test.js"]},"readmeFilename":"README.md","readme":"# Wonka\n\nA fast push & pull stream library for Reason, loosely following the [callbag spec](https://github.com/callbag/callbag)\n\n[![Build Status](https://travis-ci.org/kitten/wonka.svg?branch=master)](https://travis-ci.org/kitten/wonka)\n[![Coverage Status](https://coveralls.io/repos/github/kitten/wonka/badge.svg?branch=master)](https://coveralls.io/github/kitten/wonka?branch=master)\n[![npm](https://img.shields.io/npm/v/wonka.svg)](https://www.npmjs.com/package/wonka)\n[![npm](https://img.shields.io/npm/l/wonka.svg)](https://www.npmjs.com/package/wonka)\n\n> “There’s no earthly way of knowing<br>\n> Which direction we are going<br>\n> There’s no knowing where we’re rowing<br>\n> Or which way the river’s flowing” － **Willy Wonka**\n\n<br>\n\n![Wonka](/docs/wonka.jpg?raw=true)\n\n* [What is `Wonka`](#what-is-wonka)\n* [Why it exists](#why-it-exists)\n* [Installation](#installation)\n* [Getting Started](#getting-started)\n* [Documentation (In Progress)](#documentation)\n\n## What is `Wonka`\n\n`Wonka` is a library for lightweight observables and iterables loosely based on the [callbag spec](https://github.com/callbag/callbag).\nIt exposes a set of helpers to create and transform sources and output sinks, meaning it helps you to turn an event source or an\niterable set of data into streams, and manipulate these streams.\n\n## Why it exists\n\nReason has been becoming increasingly popular, but it's missing a good pattern for streams that feels native to the language.\nThe functional nature of callbags make them a perfect starting point to fix this, and to introduce a reactive programming\npattern to a language that is well suited for it.\n\nHence `Wonka` is a library that aims to make complex streams of data easy to deal with.\n\n## Installation\n\nInstall the library first: `yarn add wonka` or `npm install --save wonka`,\n\nThen add `wonka` to `bs-dependencies` in your `bsconfig.json` file like so:\n\n```diff\n{\n  \"name\": \"<your name>\",\n  \"version\": \"0.1.0\",\n  \"sources\": [\"src\"],\n  \"bsc-flags\": [\"-bs-super-errors\"],\n  \"bs-dependencies\": [\n+    \"wonka\"\n  ]\n}\n```\n\n## Getting Started\n\nWriting your first stream is very easy! Let's suppose you would like to create a stream from a list, filter out some values,\nthen map over the remaining ones, and lastly iterate over the final values.\n\nThis can be done with a few operators that might remind you of functions you would also call on iterables.\n\n```reason\nlet example = [1, 2, 3, 4, 5, 6];\n\nWonka.fromList(example)\n  |> Wonka.filter((.x) => x mod 2 === 0)\n  |> Wonka.map((.x )=> x * 2)\n  |> Wonka.forEach((.x) => print_endline(string_of_int(x)));\n\n/* prints: 4, 8, 12 */\n```\n\nTo explain what's going on:\n\n- `fromList` creates a pullable source with values from the list\n- `filter` only lets even values through\n- `map` multiplies the values by `2`\n- `forEach` pulls values from the resulting source and prints them\n\nAs you can see, all helpers that we've used are exposed on the `Wonka` module.\nBut if we would like to use JavaScript-based APIs, then we need to use the `WonkaJs` module.\n\nLet's look at the same example, but instead of a list we will use an `interval` stream.\nThis stream will output ascending numbers starting from `0` indefinitely.\n\nWe will code the same example as before but we'd like the `interval` to push\na new number every `50ms` and to stop after seven values.\n\n```reason\nWonkaJs.interval(50)\n  |> Wonka.take(7)\n  |> Wonka.filter((.x) => x mod 2 === 0)\n  |> Wonka.map((.x) => x * 2)\n  |> Wonka.forEach((.x) => print_endline(string_of_int(x)));\n\n/* prints: 4, 8, 12 */\n```\n\nThe last three functions stay the same, but we are now using `interval` as our source.\nThis is a listenable source, meaning that it pushes values downwards when it sees fit.\nAnd the `take` operator tells our source to stop sending values after having received seven\nvalues.\n\nAnd already you have mastered all the basics of `Wonka` and learned about a couple of its operators!\nGo, you! :tada:\n\n## Documentation\n\nI am currently still working on getting some documentation up and running. Those will contain:\n\n- The API, i.e. a list of all helpers\n- Examples\n- Usage Guides & Recipes\n- Developer Guides (How to write a source/operator/sink)\n- Modified Callbag spec\n\nStay tuned and read the signature files in the meantime please:\n\n- [wonka.rei](./src/wonka.rei)\n- [wonkaJs.rei](./src/wonka.rei)\n\n","description":"A fast push & pull stream library for Reason, loosely following the [callbag spec](https://github.com/callbag/callbag)","licenseText":"MIT License\n\nCopyright (c) 2018 Phil Plückthun\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"wonka@3.0.0-2.beta","dist":{"shasum":"aa952bc91e9e5977cb49bd729297d885c5e68ba2","integrity":"sha512-EXtmHv3O6V0NELa41FW5KQN5X8htUl3a9SsneMVGMYXIbHaqgrpQPvMTnks4tM6p5tsvRTgACXBzUGieP/4H5A==","tarball":"http://registry-npm.ywwl.com/wonka/download/wonka-3.0.0-2.beta.tgz","fileCount":312,"unpackedSize":488869,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc0LuNCRA9TVsSAnZWagAAdfcP/jqn47kX8TjgElxGrMw0\nUJDQFLhqglWrS4ovZCMEIbLikGD28GpLZsKSLHwrh3kXGtdcQ9W2PlllHtRZ\nJ/S2AJtOCe541WtRTW0vp54vjRMQKIixwtvBId6TDnpQgE5RntMck1ly9dZq\nF1tENY59sR5hFUg0vtRCliAYz4UscFtjSWS6j7RZxiEm+0aJyLixwfrwnpDx\nAk4IQ5C51xr3PXOTDoPILIpy+rk9ndqYSSTGBtPC/dDGPAx+PgOVKOpmMyPc\nRF1/cFj1I03KlSpxaZ4Iw0yLDHVKD7HaCecDMAMJQzMlVThZ9KuvdzakQxHF\n3Vq52srwYJfklDASZj2H+f5RcdwsToad7wOG51ZCCc6euCP8Ed7FIcpDEY/2\nfbQjHyIQ8hsExxV2eQq29+zCIzTzcuTelJp+hlCOBtwaqF0aXW7IZpw25ih2\nCNbjKcsatcHE/PCYH2ByDi6lWql48bzuUc/xeGpHGyYyJeF7njxi1nmjGwcZ\nXOeAsN5k+JajieFLniN2ToDoY5zhvhDCON1YZlIzJ0KC5V0M5PTO6skRDQtP\nuovndGpv5e0WTBvxOjYWCAlpca1438PZc2G42k8s705E+OXi/6ZDyY7wGwO7\nr20IReDuY8ubPfTMnMA8fi83YLSwpF+SFvvOm8l8l1vfbDt9YskyNFBg6R78\nP7Qk\r\n=i+jN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFGGwTzf6K1hPKxzxVcmHjak/7MsdN7va48Hu2iypzo1AiEAjKn1OpTuTOL3N3pOfw91+Yj+RMkIiiQOjHFoyca6h3M="}],"size":62474,"noattachment":false,"key":"/wonka/-/wonka-3.0.0-2.beta.tgz"},"maintainers":[{"email":"phil@kitten.sh","name":"philpl"}],"_npmUser":{"name":"philpl","email":"phil@kitten.sh"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/wonka_3.0.0-2.beta_1557183373256_0.5467751087127828"},"_hasShrinkwrap":false,"publish_time":1557183373391,"_cnpm_publish_time":1557183373391,"dist-tags":{"canary":"6.3.6-canary-8bdb42c9bcf34a50c25e9d9b5223159f212753df","latest":"6.3.6","rc":"5.0.0-rc.1"}}