js-actions
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

JS Actions

Get started

$ yarn add js-actions

Example

type ExampleReturnTypes = {
  first: number
  second: number
  sum: number
  even: boolean
  logEven: void
  logOdd: void
}

runPipeline<ExampleReturnTypes>({
  first: {
    run: () => 1,
  },
  second: {
    run: () => 2,
  },
  sum: {
    deps: ['first', 'second'],
    run: ({ first, second }) => first + second,
  },
  even: {
    deps: ['sum'],
    run: ({ sum }) => sum % 2 === 0,
  },
  logEven: {
    deps: ['even'],
    if: ({ even }) => even,
    run: () => console.log('Even'),
  },
  logOdd: {
    deps: ['even'],
    if: ({ even }) => !even,
    run: () => console.log('Odd'),
  }
})

Dependents (0)

Package Sidebar

Install

npm i js-actions

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

153 kB

Total Files

27

Last publish

Collaborators

  • risenforces