0.0.4 • Published 5 years ago

wrap-hook v0.0.4

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

wrap-hook

Install

npm i -S wrap-hook

How to use

import wraphook from 'wrap-hook'

const TRUSY_BEFORE = () => true;
const AFTER_CALL = ()=>{ console.log('after is called!')}

const wrapped = wraphook({ before: TRUSY_BEFORE, after: AFTER_CALL });
wrapped((callback) => {
  console.log('write business code here.')
  callback();
});
// write business code here.
// after is called!
import wraphook from 'wrap-hook'

const FALSY_BEFORE = () => false;
const AFTER_CALL = ()=>{ console.log('after is called!')}

const wrapped = wraphook({ before: FALSY_BEFORE, after: AFTER_CALL });
wrapped((callback) => {
  console.log('write business code here.')
  callback();
});
// no log!
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago