diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-07-19 19:49:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-19 19:49:44 +0200 |
commit | fa61956f03491101b6ef64423ea2f1f73af26a73 (patch) | |
tree | c3800702071ca78aa4dd71bdd0a59a9bbe460bdd /cli/js/ops/get_random_values.ts | |
parent | 53adde866dd399aa2509d14508642fce37afb8f5 (diff) |
Port internal TS code to JS (#6793)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/js/ops/get_random_values.ts')
-rw-r--r-- | cli/js/ops/get_random_values.ts | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/cli/js/ops/get_random_values.ts b/cli/js/ops/get_random_values.ts deleted file mode 100644 index 5a45a79d7..000000000 --- a/cli/js/ops/get_random_values.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { sendSync } from "./dispatch_json.ts"; -import { assert } from "../util.ts"; - -export function getRandomValues< - T extends - | Int8Array - | Uint8Array - | Uint8ClampedArray - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array, ->(typedArray: T): T { - assert(typedArray !== null, "Input must not be null"); - assert(typedArray.length <= 65536, "Input must not be longer than 65536"); - const ui8 = new Uint8Array( - typedArray.buffer, - typedArray.byteOffset, - typedArray.byteLength, - ); - sendSync("op_get_random_values", {}, ui8); - return typedArray; -} |