cloakjs

1.0.1 • Public • Published

cloak.js

A small AOP/Proxy/Wrapper library with a fluent interface

Build Status Coveralls Status license

Basic examples

function myAlertFn(msg){
    console.warn('don\'t use alerts please!');
    console.log(msg);
}
 
cloak(window, 'alert').cloakWith(myAlertFn);
 
window.alert('test'); //The result will be in the console (warn): "don't use alerts please!"
                      //Then in the console (log): "test"
 
//you can also conditionally cloak things
//This example would use a custom logger when 'myIETest' is true
//Otherwise it would just use console.log
cloak(console, 'log').when(myIETest).cloakWith(myLoggerFn)
                     .when(!myIETest).callOriginal;

Installation

npm install --save-dev cloakjs 

or

bower install cloakjs

Documentation

To learn more checkout the documentation page

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    8
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    8
  • 1.0.0
    1
  • 0.0.1
    0

Package Sidebar

Install

npm i cloakjs

Weekly Downloads

6

Version

1.0.1

License

MIT

Last publish

Collaborators

  • mdvorscak