Skip to content

Commit

Permalink
fix: review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Sep 16, 2023
1 parent 9bb6315 commit 8cea5ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/exo/src/exo-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const MinMethodGuard = M.call().rest(M.any()).returns(M.any());
/**
* @param {Passable[]} args
* @param {MethodGuardPayload} methodGuardPayload
* @param {string | undefined} label
* @param {string} [label]
* @returns {Passable[]} Returns the args that should be passed to the
* raw method
*/
const defendSyncArgs = (args, methodGuardPayload, label) => {
const defendSyncArgs = (args, methodGuardPayload, label = undefined) => {
const { argGuards, optionalArgGuards, restArgGuard } = methodGuardPayload;
const paramsPattern = M.splitArray(
argGuards,
Expand All @@ -55,6 +55,7 @@ const defendSyncArgs = (args, methodGuardPayload, label) => {
if (args.length <= declaredLen) {
return args;
}
// Ignore extraneous arguments, as a JS function call would do.
return args.slice(0, declaredLen);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/exo/test/test-heap-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('what happens with extra arguments', t => {
t.is(x, undefined);
},
});
exo.foo(8);
exo.foo('an extra arg');
});

const UpCounterI = M.interface('UpCounter', {
Expand Down

0 comments on commit 8cea5ce

Please sign in to comment.