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

ordu

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ordu

Execute functions in a configurable order, modifying a shared data structure.

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.8K
increased by16.6%
Maintainers
1
Weekly downloads
 
Created
Source

ordu

npm version Build Coverage Status Dependency Status DeepScan grade Maintainability

Execute functions in a configurable order, modifying a shared data structure.

Task functions are executed in order of addition, and passed a shared context, a modifiable data structure, and task meta data. Execution is synchronous or asynchronous. You can control execution by returning commands from a task function.

You can add tasks before and after existing named tasks.

This module is used by the Seneca framework to provide configurable extension hooks to various internal processes.

Quick example

NOTE: OUT-OF-DATE

SEE TESTS FOR API CHANGES

TODO: UPDATE README

const Ordu = require('ordu')

let process = new Ordu()

process.add(function first(spec) {
  if (null == spec.data.foo) {
    return {op: 'stop', err: new Error('no foo')}
  }

  spec.data.foo = spec.data.foo.toUpperCase() + spec.ctx.suffix

  // Default is to continue to next step.
})


const ctx = { suffix: '!!!' }
let data = { foo: 'green' }

process.execSync(ctx, data)
console.log(data.foo) // prints 'GREEN!!!' (first)


process.add(function second(spec) {
  spec.data.foo = spec.ctx.prefix + spec.data.foo
})

ctx.prefix = '>>>'
data = { foo: 'blue' }

process.execSync(ctx, data)
console.log(data.foo) // prints '>>>BLUE!!!' (first, second)

Install

npm install ordu

Notes

From the Irish ordú: instruction. Pronounced or-doo.

License

Copyright (c) 2014-2021, Richard Rodger and other contributors. Licensed under MIT.

Keywords

FAQs

Package last updated on 04 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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