From a7f5589881fe4e8881d4e29ef43fc299d6e1dcfb Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 22 Feb 2021 22:32:09 +0100 Subject: [PATCH] Tighten and simplify --- actor.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/actor.ts b/actor.ts index 198cef6..5589333 100644 --- a/actor.ts +++ b/actor.ts @@ -92,10 +92,8 @@ export class Turn { return new Ref(this._ensureActor(what), t); } - spawn(bootProc: (t: Turn) => void, initialAssertions?: IdentitySet): void { - if ((initialAssertions !== void 0) && (initialAssertions.size > 0)) { - this._ensureActor("spawn with initialAssertions"); - } + spawn(bootProc: (t: Turn) => void, initialAssertions = new IdentitySet()): void { + if (initialAssertions.size > 0) this._ensureActor("spawn with initialAssertions"); this.localActions.push(() => { const child = new Actor(this.actor === null ? void 0 @@ -157,13 +155,11 @@ export class Turn { } } -function extractFromMap(map: Map, keys?: IdentitySet): Map { +function extractFromMap(map: Map, keys: IdentitySet): Map { const result: Map = new Map(); - if (keys !== void 0) { - keys.forEach(key => { - if (map.has(key)) result.set(key, map.get(key)!); - map.delete(key); - }); - } + keys.forEach(key => { + if (map.has(key)) result.set(key, map.get(key)!); + map.delete(key); + }); return result; }