rosmaro-graph-from-arrows

1.0.0 • Public • Published

Rosmaro Graph From Arrows

for simple graphs, Rosmaro is verbose, this module just simplifies making a graph from just the Arrows

npm i rosmaro-graph-from-arrows --save

then define your arrows

const fromArrows = require('rosmaro-graph-from-arrows')

let arrows = {
  Off: { 'evening start': { target: 'EveningLights' } },
  EveningLights: { 'bed': { target: 'EveningOff' } },
  EveningOff: {
    'morning activity': { target: 'MorningLights' },
    'quiet morning': { target: 'Off' },
  },
  MorningLights: { 'dawn start': { target: 'Off' } }
}
// handler functions
const Off = ({action, context, node}) => {
  if (action.type === 'PING' && between(action, 'sunset', 'sunrise')) return change(action, context, node, 'evening start')
  return noChange(context)
}
let handlers = {main, Off, EveningLights, EveningOff, MorningLights} // this are functions

const {graph, bindings} = fromArrows(arrows, handlers)

Readme

Keywords

Package Sidebar

Install

npm i rosmaro-graph-from-arrows

Weekly Downloads

3

Version

1.0.0

License

ISC

Unpacked Size

2.06 kB

Total Files

3

Last publish

Collaborators

  • eckoit