Novices Plagiarizing Mozart
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

taskplanner

0.0.3 • Public • Published

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

Keywords

none

install

npm i taskplanner

Downloadsweekly downloads

12

version

0.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability