initial commit
This commit is contained in:
28
node_modules/newify/getInstantiatorFunction.js
generated
vendored
Normal file
28
node_modules/newify/getInstantiatorFunction.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
module.exports = function(){
|
||||
|
||||
'use strict';
|
||||
|
||||
var fns = {}
|
||||
|
||||
return function(len){
|
||||
|
||||
if ( ! fns [len ] ) {
|
||||
|
||||
var args = []
|
||||
var i = 0
|
||||
|
||||
for (; i < len; i++ ) {
|
||||
args.push( 'a[' + i + ']')
|
||||
}
|
||||
|
||||
fns[len] = new Function(
|
||||
'c',
|
||||
'a',
|
||||
'return new c(' + args.join(',') + ')'
|
||||
)
|
||||
}
|
||||
|
||||
return fns[len]
|
||||
}
|
||||
|
||||
}()
|
||||
Reference in New Issue
Block a user