1.0.0 • Published 9 years ago

nonew v1.0.0

Weekly downloads
3
License
MPL-2.0
Repository
github
Last release
9 years ago

nonew.js

Allows constructor functions to be called without using new

Example

Consider this constructor function:

function Person(name) {
  this.name = name;
}

Normally to instantiate it, we'd do:

var myself = new Person('Corey Farwell');

With nonew.js, we can create an alternate constructor that doesn't require the use of new:

var nonew = require('nonew');

var person = nonew(Person);

Now we can do:

var myself = person('Corey Farwell');

License

Mozilla Public License version 2