Not Preposterously Macho
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

huskies

0.0.9 • Public • Published

huskies

method or function processor before execution.

"huskies"

Install

npm install huskies

version

0.0.7

API

var wrap = huskies(method)
          .use(middle1)
          .set(...)
          .use(middle2)
          .set(...)
          .seal();

How write middle

Example:

function middle(avgs,options,locals,exec){
    // avgs is arguments array object.
    // options is wrap.set() args , is only read.
    // locals is share data .
    // exec(false) break default execute and break after middles.
    // exec(avgs) in advance of the function.
}

Example:

var huskies = require("./");
 
function num_validator(avgs,num,locals,exec){
     if(avgs.length !== (num[0] | 2)){
        throw {name:"len error",
               message:"arguments length must 3."}
     }
}
 
function test(name,age,id){
    console.log(name);
}
 
wrap = 
    huskies(test)
   .use(num_validator)
   .set(3) // if set 3 , then no throw , otherwise throw error.
   .seal();
   
wrap("leo",25,"id001");

LICENSE

MIT

Keywords

none

install

npm i huskies

Downloadsweekly downloads

0

version

0.0.9

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability