Skip to content

Commit

Permalink
Fix: Remove call() function
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Sep 23, 2020
1 parent 7b0d75d commit bbb9d7f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/pledge-operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ export class PledgeCapability {
this.pledge = new C(executor);

if (!isCallable(this.resolve)) {
throw new TypeError("resolve function is not callable.");
throw new TypeError("resolve is not callable.");
}

if (!isCallable(this.reject)) {
throw new TypeError("reject function is not callable.");
throw new TypeError("reject is not callable.");
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/pledge.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { PledgeSymbol } from "./pledge-symbol.js";
import { PledgeReactionJob, hostEnqueuePledgeJob } from "./pledge-jobs.js";
import { isObject, isCallable, call } from "./utilities.js";
import { isObject, isCallable } from "./utilities.js";
import {
isPledge,
createResolvingFunctions,
Expand Down Expand Up @@ -120,14 +120,14 @@ export class Pledge {
} else {

thenFinally = value => {
const result = call(onFinally, undefined);
const result = onFinally.apply(undefined);
const pledge = pledgeResolve(C, result);
const valueThunk = () => value;
return pledge.then(valueThunk);
};

catchFinally = reason => {
const result = call(onFinally, undefined);
const result = onFinally.apply(undefined);
const pledge = pledgeResolve(C, result);
const thrower = () => {
throw reason;
Expand Down
4 changes: 2 additions & 2 deletions tests/pledge-operations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("pledge-operations", () => {
it("should throw an error when a regular function is passed", () => {
expect(() => {
new PledgeCapability(function() {});
}).to.throw(/resolve function is not callable/);
}).to.throw(/resolve is not callable/);
});

it("should throw an error when a regular function is passed without a reject parameter", () => {
Expand All @@ -71,7 +71,7 @@ describe("pledge-operations", () => {

expect(() => {
new PledgeCapability(FakePledge);
}).to.throw(/reject function is not callable/);
}).to.throw(/reject is not callable/);
});
});

Expand Down

0 comments on commit bbb9d7f

Please sign in to comment.