huskies
v0.0.9
Published
method or function processor before execution.
Downloads
6
Readme
huskies
method or function processor before execution.
API
var wrap = huskies(method) .use(middle1) .set(...) .use(middle2) .set(...)
How write middle
Example:
function middle(avgs,options,locals,exec){
// avgs is arguments array object.
// options is wrap.set() args.
// locals is share data .
// exec() is execute method, when call exec, after middle no execute.
}
Example:
var huskies = require("./");
function num_validator(avgs,num,locals,exec){
if(avgs.length !== (num | 2)){
throw {name:"len error",
message:"arguments length must 3."}
}
}
function test(name,age,id){
console.log(name);
}
var wrap =
huskies(test)
.use(num_validator)
.set(3); // if set 3 , then no throw , otherwise throw error.
wrap("leo",25,"id001");
LICENSE
MIT