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

    node-forwardablepublic

    node-forwardable

    Ruby's forwardable inspired module which defines delegatable functionality of methods for a class.

    Install

    npm install node-forwardable
    

    Example

    var util = require('util')
      , log = console.log.bind(console)
      , forwardable = require('node-forwardable');
    
    Stack = function() {
      this.content = [];
      this.defDelegator('content', 'push', 'pop');
    };
    util._extend(Stack.prototype, forwardable);
    
    s = new Stack;
    s.push(1);
    s.push(2);
    s.push(3);
    log(s.pop()); // => 3
    log(s.pop()); // => 2
    log(s.pop()); // => 1
    

    Keywords

    none

    install

    npm i node-forwardable

    Downloadsweekly downloads

    7

    version

    0.0.3

    license

    none

    last publish

    collaborators

    • avatar