npm.io
0.1.1 • Published 13 years ago

track

Licence
Version
0.1.1
Deps
0
Vulns
0
Weekly
0
Stars
1

Track.js

Install

$ npm install -S track

Include track

var track = require('track')

Express example

app.get('/', function (req, res, next) {
  var t = track()

  db.select('user', t('user'))

  db.select('data', t('data'))

  t.end(function (err, locals) {
    if (err) return next(err)

    res.render('something', locals)
  })
})

Hello World example

var t = track()

t('name', function (cb) {
  cb(null, 'World')
})()

t('hello', ['name'], function (name, cb) {
  cb(null, 'Hello ' + name)
})()

t.end(function (err, results) {
  console.log(results.hello === 'Hello World')
})

Licence

MIT