Call initialize method, if not exists then call init. Many nodejs module... #1

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@gabrieleds
Contributor

... already use init as primary method, it will cause errors.

@gabrieleds gabrieleds Call initialize method, if not exists then call init. Many nodejs mod…
…ule already use init as primary method, it will cause errors.
58266de
@daffl
Owner
daffl commented May 9, 2012

Thanks! What would you think about making this a little more flexible and adding an option to map the init methodname (which in fact is the only name that could cause an error):

{
    "__init" : "myFn",
    "myFn" : function() {
        // This is now being used as the constructor
    }
}
@gabrieleds
Contributor

It sounds perfect.

@daffl
Owner
daffl commented May 10, 2012

I just pushed a new version 1.0.2 and published it to NPM. It works as described above. Hope that help!

@daffl daffl closed this May 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment