Purpose
Calling function constructors with an array of arguments is difficult.
For a given function constructor
function Student(firstName, lastName, birthYear){
this.firstName = firstName
this.lastName = lastName
this.birthYear = birthYear
}
We want to easily call the function constructor like
var arr = ['john','scot', 1980]
var s = new Student(arr)
NEWIFY to the rescue!
var arr = ['john','scot', 1980]
var s = require('newify')(Student, arr)
Installation
npm install newify
Usage
As in the above example, just give newify
a function and an array of args
var arr = ['john','scot', 1980]
var s = require('newify')(Student, arr)