Remove arguments references where possible.

This commit is contained in:
John-David Dalton
2017-01-09 18:30:38 -08:00
parent f2c49500ee
commit 627bfe6bfa
5 changed files with 7 additions and 33 deletions

View File

@@ -10,11 +10,10 @@ import isObject from './isObject.js';
* @returns {Function} Returns the new wrapped function.
*/
function createCtor(Ctor) {
return function() {
return function(...args) {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
const args = arguments;
switch (args.length) {
case 0: return new Ctor;
case 1: return new Ctor(args[0]);