use register for degradeBy / undegradeBy

This commit is contained in:
Felix Roos 2022-12-10 19:25:51 +01:00
parent 4340f024d3
commit 09b15a07c6
3 changed files with 11 additions and 22 deletions

View file

@ -1277,9 +1277,9 @@ export function register(name, func) {
args = args.map(reify);
// For methods that take a single argument (plus 'this'), allow
// multiple arguments but sequence them
if (arity == 2 && args.length != 1) {
if (arity === 2 && args.length !== 1) {
args = [sequence(...args)];
} else if (arity != args.length + 1) {
} else if (arity !== args.length + 1) {
throw new Error(`.${name}() expects ${arity - 1} inputs but got ${args.length}.`);
}
return pfunc(...args, this);