Future gun
Gun.js extensions for Promise
based async flow control.
Promise methods are prefixed with $
by convention.
Install
npm: npm i -S future-gun
(soon)
yarn: yarn add future-gun
(soon)
from github: npm i -S kristianmandrup/future-gun
Dependencies
gun
v. 0.6 or higherchain-gun
Use
Assumes Babel.js or similar transpiler setup
To add all chain methods
To control which chain methods to add
Import individual chain modules
Require (Node.js)
Using require
const Gun = Gun
Promise extensions
ES6 Promise
or ES7 async/await
) are always prefixed with $
.$fields(opt)
- get fields (ie. property names).$iterate(opts)
- iterate.$mapReduce(options, putCb, opt)
- map/reduce.$no(opt)
- blocks if no data, see no.$val(opt)
- full value (with meta).$value(opt)
- get value (no meta).$valueAt(path, opt)
- get value at thepath
(no meta).$put(opt)
- put value and wait until done (synced).$putAt(path, opt)
- put value at thepath
and wait until done (synced).$recurse(filter)
- recursive filter.$timed(opts)
- timed recursion
mapReduce
See full mapReduce guide
Contributing
Install dependency modules/packages
npm i
Compile/Build
The project includes a gulpfile
configured to use Babel 6.
All /src
files are compiled to /dist
including source maps.
Scripts:
- start:
npm start
- build:
npm run build
(ie. compile) - watch and start:
npm run watch
- watch and build:
npm run watch:b
Run Tests
npm test
or simply ava test
License
MIT Kristian Mandrup