diff options
author | Stanislav <62983943+stanislavstrelnikov@users.noreply.github.com> | 2020-07-07 04:45:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 21:45:39 -0400 |
commit | 158ae0bfe900d2bac3076390c4fe3d2b54d94fe5 (patch) | |
tree | 209e4b5682e2a899041767c49428e34329e48084 /cli/js/ops/dispatch_minimal.ts | |
parent | ab4c574f5202f607ceb6068f56b3cc8aed1bbbaf (diff) |
clean up code in cli/js (#6611)
Diffstat (limited to 'cli/js/ops/dispatch_minimal.ts')
-rw-r--r-- | cli/js/ops/dispatch_minimal.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cli/js/ops/dispatch_minimal.ts b/cli/js/ops/dispatch_minimal.ts index 0d1dac44e..ca50b00e9 100644 --- a/cli/js/ops/dispatch_minimal.ts +++ b/cli/js/ops/dispatch_minimal.ts @@ -1,13 +1,15 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. + import * as util from "../util.ts"; import { core } from "../core.ts"; import { TextDecoder } from "../web/text_encoding.ts"; import { ErrorKind, errors, getErrorClass } from "../errors.ts"; // Using an object without a prototype because `Map` was causing GC problems. -const promiseTableMin: { - [key: number]: util.Resolvable<RecordMinimal>; -} = Object.create(null); +const promiseTableMin: Record< + number, + util.Resolvable<RecordMinimal> +> = Object.create(null); // Note it's important that promiseId starts at 1 instead of 0, because sync // messages are indicated with promiseId 0. If we ever add wrap around logic for @@ -93,7 +95,7 @@ export async function sendAsyncMinimal( scratch32[2] = 0; // result const promise = util.createResolvable<RecordMinimal>(); const buf = core.dispatchByName(opName, scratchBytes, zeroCopy); - if (buf) { + if (buf != null) { const record = recordFromBufMinimal(buf); // Sync result. promise.resolve(record); |