Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pastafarian

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pastafarian - npm Package Compare versions

Comparing version 0.9.3 to 0.9.4

14

package.json
{
"name": "pastafarian",
"version": "0.9.3",
"version": "0.9.4",
"description": "A tiny event emitter-based finite state machine",
"main": "pastafarian.js",
"scripts": {
"test": "",
"develop": "onchange 'pastafarian.js' 'test/*' -- npm run test:node",
"minify": "",
"minify": "uglifyjs pastafarian.js -o pastafarian.min.js -c --m",
"test:node": "electron-mocha --reporter spec ./test",
"test:browser": "electron-mocha --renderer --preload test/browser-shim.js --preload pastafarian.js --reporter spec ./test"
"test:browser": "electron-mocha --renderer --preload test/browser-shim.js --preload pastafarian.js --reporter spec ./test",
"test:minified": "electron-mocha --renderer --preload test/browser-shim.js --preload pastafarian.min.js --reporter spec ./test"
},

@@ -23,3 +23,4 @@ "repository": {

"fsm",
"state"
"state",
"event"
],

@@ -36,4 +37,5 @@ "author": "Patrik Johnson <patrik@zebros.fi>",

"onchange": "2.2.0",
"sinon": "1.17.3"
"sinon": "1.17.3",
"uglify-js": "2.6.2"
}
}

@@ -55,3 +55,3 @@ ;(function (root) {

emit(next, [prev].concat(params));
emit('all', [prev, next].concat(params));
emit('*', [prev, next].concat(params));
} else {

@@ -58,0 +58,0 @@ onError([new ITE(prev, next), prev, next].concat(params));

# pastafarian
> A tiny event emitter-based finite state machine
### Under development, but usable
[![Build Status](https://travis-ci.org/orbitbot/pastafarian.svg?branch=master)](https://travis-ci.org/orbitbot/pastafarian)
![Uncompressed size](https://badge-size.herokuapp.com/orbitbot/pastafarian/master/pastafarian.js?color=red)
![minfied size](https://badge-size.herokuapp.com/orbitbot/pastafarian/master/pastafarian.min.js?color=yellow&label=minfied size)
![minfied+gzipped size](https://badge-size.herokuapp.com/orbitbot/pastafarian/master/pastafarian.min.js?label=gzipped.min&compression=gzip)
Grab a lightweight event emitter implementation, add some logic to track states and Voilà! A tiny finite state machine implementation at around 500 bytes minfied and gzipped.
- configure when initializing only (demo helpers to add/remove states?)
- state transition semantics vs "event" semantics (no methods/mixin)
- state transition semantics vs "event" semantics (no methods/mixin), name your states, not your transitions
- synchronous state transfers (althrough doesn't care about the contents of your callbacks)
...

@@ -24,4 +31,6 @@

- helper for next method
- helper for "can/cannot"
- helper for "is"
- helper for 'once' callback
- helper to add / remove states

@@ -31,3 +40,3 @@ <br>

- https://github.com/jeromeetienne/microevent.js
The event emitter pattern that `pastafarian` uses at its core is based on [microevent.js](https://github.com/jeromeetienne/microevent.js).

@@ -37,10 +46,29 @@ <br>

- https://github.com/jakesgordon/javascript-state-machine
- https://github.com/ifandelse/machina.js
Too basic? Not quite what you were looking for? Some other alternatives for state machines in javascript are
- [javascript-state-machine](https://github.com/jakesgordon/javascript-state-machine)
- [machina.js](https://github.com/ifandelse/machina.js)
<br>
#### Notes
#### License
- transition function returns a promise? / proomise API ?
- transition function supports result callback?
- a transtition that throws an error can be canceled?
`pastafarian.js` is ISC licensed.
<br>
#### Development
A basic development workflow is defined using npm run scripts. Get started with
```sh
$ git clone https://github.com/orbitbot/pastafarian
$ npm install
$ npm run develop
```
Bugfixes and improvements are welcome, however, please open an Issue to discuss any larger changes beforehand, and consider if functionality can be implemented with a simple monkey-patching extension script. Useful extensions are more than welcome!
<br>
#### Possible future development
- transition function returns a promise?
- a transition that throws an error can be canceled?
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc