New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fn-machine

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fn-machine - npm Package Compare versions

Comparing version 0.0.3 to 0.0.5

src/fn-machine.d.ts

15

package.json
{
"name": "fn-machine",
"version": "0.0.3",
"version": "0.0.5",
"description": "a tiny functional state machine",
"main": "index.js",
"main": "index",
"directories": {

@@ -12,3 +12,4 @@ "example": "example"

"type-check": "tsc --noEmit",
"release": "npm run type-check && np"
"release": "npm run type-check && np",
"build-typings": "tsc -p tsconfig-typings.json"
},

@@ -33,4 +34,8 @@ "repository": {

"np": "^5.0.3",
"sinon": "^7.3.2"
}
"sinon": "^7.3.2",
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/41996/artifacts?artifactName=tgz&fileId=967EC7B6DC9AAC54797655C1C1403FFCE2BEBB49FBAD58A0AC397F5F2F10AEE202&fileName=/typescript-3.7.0-insiders.20190829.tgz"
},
"files": [
"src/*"
]
}
### fn-machine
A tiny, functional state machine implementation
A tiny, functional, state machine utility
#### install
...
`npm install fn-machine`
#### usage
see example
see [example](https://github.com/jrobinson01/fn-machine/blob/master/example/index.html)

@@ -1,13 +0,5 @@

/**
* @typedef CurrentState
* @property {string} state
* @property {Object} context
*/
/** @typedef {import('./fn-state').CurrentState} CurrentState */
/** @typedef {import('./fn-state').State} State */
// annoyingly, this typedef has to be duplicated from fn-state.js??
/**
* @typedef {{name:string, transitions:Object, enter:function, exit:function}} State
*/
/**
/**
* @description define a state machine

@@ -14,0 +6,0 @@ * @param {Array<!State>} states

/**
* @typedef {Object.<string, function(Object, Object):Object>} Transition
* @typedef {{state:string, context?:any}} CurrentState
*/
/**
* @typedef {{name:string, transitions:Object, enter:function, exit:function}} State
* @typedef {function(Object, Object):CurrentState} Transition
*/
/**
* @typedef {{name:string, transitions:Object.<string, Transition>, enter:function, exit:function}} State
*/
/**
* @description define a single state
* @param {string} name
* @param {Object.<string, Transition>=} transitions
* @param {function=} enterFn
* @param {function=} exitFn
* @param {Object.<string, Transition>} transitions
* @param {function(Object)=} enterFn
* @param {function(Object)=} exitFn
* @return {!State}
*/
export default function state(name, transitions = {}, enterFn = () => {}, exitFn = () => {}) {
export default function state(name, transitions, enterFn = () => {}, exitFn = () => {}) {
return {name, transitions, enter: enterFn, exit: exitFn};
}
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