0.0.1 • Published 9 years ago

deductive v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

deductive

Because building logic inside of a controller should be easy.

Random ideas my brain comes up with before going to bed.

Idea: Use JSON to build controller logic Inspiration: Mithril.js on how it renders the virtual dom — its M function & treeline

Possible concept:

{
  users: {
    create: {
      actions: [{
        0: [ { helpers.hyg: __data__ }, {models.updateUser: __data__.user}],
        1: [ { fluent: 0 }]
      },
      {
        0: { response: 0 }
      }],
      models: {
        getUser: [ctx._waterline.collections.findOne(injection)],
        updateUser: [ctx._waterline.collections.findOne(injection)] 
      }
      helpers: {
        hyg: [validate],
        fluent: [fluent]
      }
    }
  }
}

###What does the above do?

Key: data is the data sent from the body parser. ctx: inherited through the app of this instance.

Actions will always have two objects: first being a set of objects with synchronous arrays of functions that inherits or depends on the previous action(if/else/ results, etc). Each action is performed inside the first object, once complete, it gets the last result from a specific object key --what's neat is we could prefix for async functionality this way with a preconditioning parent before the array as an object. Each key inside of the actions' array key array will be a promise.

Models: Allows function inheritance passed into the application Helpers: Helpers allow the data to flow to other modules.

*Every key member of the actions first object has a try/catch?

Build visual controller logic system?

-- Peter