{"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"name":"fsm","description":"Finite State Machine - Separate Control Flow from IO","version":"0.0.1","homepage":"https://github.com/dominictarr/fsm","repository":{"type":"git","url":"git://github.com/dominictarr/fsm.git"},"main":"fsm.js","scripts":{"test":"meta-test test/*.js"},"engines":{"node":">= 0.2.0"},"dependencies":{"curry":"0.0"},"devDependencies":{"it-is":"0.0"},"_id":"fsm@0.0.1","_engineSupported":true,"_npmVersion":"1.0.12","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"c90705b8736f9c2f7185ee007a7380fd347e7e36","tarball":"http://registry-npm.ywwl.com/fsm/download/fsm-0.0.1.tgz","integrity":"sha512-C55kG4EdqdECP7zw08n25eWN9WzSmZ7WE24mjG+dwxyV1unucJNvD1SUSuFYa61GKmo9thW6mq0EkxJfq9rupA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyb11C3XL1VMLF3MAs2YmW5U7sGZq+eoVsdMivipPdJAIgRyOawUJbKeKlQcA4g+Mbh6aVS3v1hUNM7piqw1HERfs="}],"size":4087,"noattachment":false,"key":"/fsm/-/fsm-0.0.1.tgz"},"directories":{},"readme":"# fsm\n\ncheck properties of finite state machines.\n\nThere is a lot of academic research in this area, yet this module is very simple.\nThere are a lot of fancy tools available, but they are not easy to use.\nIf idea is really useful, then I think a very simple tool should be viable.\n\n## License\n\nMIT\n\n# Example\n\nDefine FSM as json, here is a stream with 4 states.\nThis FSM expresses the constraint that the stream *must not*\nemit 'data' when paused, and also that it *must not* emit\ndata after 'end'.\n\n``` js\n{\n  START: {\n    data   : 'START',\n    pause  : 'PAUSED',\n    end    : 'END',\n    error  : 'ERROR'\n  },\n  PAUSED: {\n    pause  : 'PAUSED',\n    resume : 'START',\n    error  : 'ERROR'\n  },\n  ERROR: {},\n  END: {}\n}\n```\n\nwe can check a number of properties of this machine.\ndoes this machine halt? (and in the right place?)\ncan you reach every state from every other?\n\n## API\n\n### validate (fsm)\n\ncheck that all transitions are to defined states.\n\n### reachable (fsm)\n\ncalculate all states can reach each other states.\nthe result is in the form of\n\n``` js\n{STATE1: {STATE2: [event path from S1 to S2]}}\n```\n\n### terminal (fsm)\n\nreturn the list of states that cannot reach another state.\n\nalias: `deadlock'\n\n### livelock (fsm, [terminal])\n\nget list of states that cannot reach a terminal state.\n\n### combine(fsm1, fsm2, start1, start2)\n\ncombine two fsm into one, obeying all the transitions in each.\nTODO: throw an error if there are transitions that are impossible in the combined machine.\n\n\n","publish_time":1308177465638,"maintainers":[{"email":"nopersonsmodules@gmail.com","name":"nopersonsmodules"}],"_cnpm_publish_time":1308177465638,"dist-tags":{"latest":"1.0.2"}}