0.0.2 • Published 9 years ago

uok v0.0.2

Weekly downloads
2
License
BSD
Repository
github
Last release
9 years ago

uok

The simpless way for carring errors.

Example 1

We don't need to write if-else condition and log errors. uok do for us. It is carry function arguments and if it is not null, than dump error to console.

var log = require('tracer').console({format: "{{file}}:{{line}}: {{message}}"}).log;
var ok = require('lib/ok')(log);

function log(data, cb) {
	fs.writeFile('log', data, cb);
}

log('hello', ok(function() {
	console.log('ok');
}));

Example 2

uok create method ok in prototype all functions and it allows minimize code

var log = require('tracer').console({format: "{{file}}:{{line}}: {{message}}"}).log;
var ok = require('lib/ok')(log);

function log(data, cb) {
	fs.writeFile('log', data, cb.ok(function() {
		// do somethind
		cb();
	}));
}

log('hello', ok(function() {
	console.log('ok');
}));