Skip to content

Commit

Permalink
Simplify callUserCallback code with ternary
Browse files Browse the repository at this point in the history
c193f01c51a8f65cff9c0fe82063e83b6870238f
  • Loading branch information
sabio committed Aug 12, 2024
1 parent 296255c commit ca07d08
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/utils/function/callUserCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ export const callUserCallback: CallUserCallback = function z(
if (isFunction(callback)) {
// eslint-disable-next-line prefer-rest-params
const [, , , ...args] = argsToArray(arguments);
if (!isNil(userContext)) {
callback.apply(userContext, args);
} else {
callback.apply(null, args);
}
callback.apply(isNil(userContext) ? null : userContext, args);
}
} catch (error) {
setDeferBase(ctx, bindArg(error, throwFunction), 0);
Expand Down

0 comments on commit ca07d08

Please sign in to comment.