utility library for async iterable iterators
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples start on examples Nov 12, 2015
packages add Iterable type Jul 28, 2017
.coveralls.yml fix coveralls Nov 12, 2015
.gitignore bump Jul 11, 2017
.npmignore add cov Nov 12, 2015
.travis.yml update travis config Aug 19, 2016
Gulpfile.js rebuild docs Jul 11, 2017
LICENSE Update LICENSE Oct 27, 2016
README.md update Jul 11, 2017
changelog.md add more documentation Apr 7, 2017
index.js add limit bus Aug 19, 2016
package.json add when docs Jul 11, 2017
yarn.lock get started on docs Jul 10, 2017

README.md

Build Status Coverage Status Join the chat at https://gitter.im/crcn/mesh.js

Mesh is a utility library for async iterable iterators.

Motivation

This library was originally created to handle complex data flows, and unify how applications communicate internally and externally. It also serves as a single channel for all communication which makes it more easy to control & reason about how your application is passing around data asynchronously.

Mesh provides a set of higher order functions that you can use to build your data flows out. Here's an example of that:

import { when, wrapAsyncIterableIterator, fallback } from "mesh";
import { 
  DS_FIND, 
  DS_INSERT, 
  DS_REMOVE, 
  DS_UPDATE, 
  dataStore, 
  DSFindMessage,
  whenCollection,
  DSInsertMessage,
  DSRemoveMessage,
  DSUpdateMessage,
} from "mesh-ds";

const insertTodoItem = (message: DSInsertMessage) => (
  wrapAsnycIterableIterator(fetch('/api/todos', {
    method: 'POST',
    body: message.data
  }))
);

const insert = fallback(
  whenCollection('todos', insertTodoItem),

  // more collections below
  // whenCollection('users', insertUser),
  // whenCollection('items', insertItem),
);

const dsDispatch = dataStore({
  [DS_INSERT] : insert,

  // other operations - similar code to insert
  //[DS_REMOVE] : remove,
  //[DS_UPDATE] : update,
  //[DS_FIND]   : find
});

Installation

NPM: npm install mesh
Bower: bower install mesh

Resources