newify
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "newify", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Call function constructors with an array of arguments", | ||
@@ -18,2 +18,3 @@ "main": "index.js", | ||
"object", | ||
"spread", | ||
"instantiate" | ||
@@ -20,0 +21,0 @@ ], |
# Purpose | ||
Calling function constructors with an array of arguments is difficult. | ||
Calling function constructors with an array of arguments is difficult. Until [spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator) params come to js. | ||
@@ -18,5 +18,11 @@ For a given function constructor | ||
var arr = ['john','scot', 1980] | ||
var s = new Student(arr) //but this will obviously not work | ||
var s = new Student(arr) //but this will obviously not work as expected. | ||
//we need ES6 spread | ||
var s = new Student(...arr) | ||
``` | ||
But since spread is not in ES5 yet... | ||
NEWIFY to the rescue! | ||
@@ -23,0 +29,0 @@ |
3001
53