This commit is contained in:
Simon Priet
2021-09-05 22:53:58 +02:00
commit 9e2991e668
17888 changed files with 1263126 additions and 0 deletions

29
node_modules/util-arity/arity.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
var FUNCTIONS = {};
/**
* Create a function wrapper that specifies the argument length.
*
* @param {number} arity
* @param {Function} fn
* @return {Function}
*/
module.exports = function (arity, fn) {
if (!FUNCTIONS[arity]) {
var params = [];
if (typeof arity !== 'number') {
throw new TypeError('Expected arity to be a number, got ' + arity);
}
for (var i = 0; i < arity; i++) {
params.push('_' + i);
}
FUNCTIONS[arity] = new Function(
'fn',
'return function arity' + arity + ' (' + params.join(', ') + ') { return fn.apply(this, arguments); }'
);
}
return FUNCTIONS[arity](fn);
};