🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

taskplanner

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taskplanner

Plan any task from subtasks!

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
15
150%
Maintainers
1
Weekly downloads
 
Created
Source

taskplanner

Plan any task into subtasks!

var planner   = require('taskplanner')()
  , assert    = require('assert')
  , expected  = [{
        cmd: 'get car'
    }, {
        cmd: 'drive'
      , to: 'supermarket'
    }]
  , plan

plan = planner.addTask({ cmd: 'go', to: 'supermarket' }, {
    preconditions: { state: 'in the car' }
  , subTasks: [ { cmd: 'drive', to: 'supermarket' } ]
}).addTask({ cmd: 'go', to: 'supermarket' }, {
    preconditions: { state: 'at home' }
  , subTasks: [ { cmd: 'get car' }, { cmd: 'go', to: 'supermarket' } ]
}).addTask({ cmd: 'get car' }, {
    preconditions: { state: 'at home' }
  , effects: { state: 'in the car' }
}).addTask({ cmd: 'drive', to: 'supermarket' }, {
    preconditions: { state: 'in the car' }
  , effects: { state: 'in the supermarket' }
}).plan({ state: 'at home' }, { cmd: 'go', to: 'supermarket' })

assert.deepEqual(plan, expected)

Acknowledgements

This project was kindly sponsored by nearForm.

License

MIT

FAQs

Package last updated on 06 Jun 2014

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