Skip to content

Commit

Permalink
⚡ update format
Browse files Browse the repository at this point in the history
  • Loading branch information
robinpokorny committed Dec 6, 2020
1 parent ac1b634 commit 97b3b0c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 1 addition & 3 deletions eventEmitter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ describe("Event Emitter", () => {
});

it("has simple API", () => {
const keys = Object.keys(emitter)
.sort()
.join();
const keys = Object.keys(emitter).sort().join();
expect(keys).toBe("emit,on");
});

Expand Down
4 changes: 2 additions & 2 deletions pubsub.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = () => {
const subscribers = new Set();

const sub = fn => {
const sub = (fn) => {
subscribers.add(fn);

return () => subscribers.delete(fn);
};

const pub = data => subscribers.forEach(fn => fn(data));
const pub = (data) => subscribers.forEach((fn) => fn(data));

return Object.freeze({ pub, sub });
};
4 changes: 1 addition & 3 deletions pubsub.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ describe("PubSub", () => {
});

it("has simple API", () => {
const keys = Object.keys(events)
.sort()
.join();
const keys = Object.keys(events).sort().join();
expect(keys).toBe("pub,sub");
});

Expand Down

0 comments on commit 97b3b0c

Please sign in to comment.