Skip to content

Commit e414eeb

Browse files
committed
type safety
1 parent 8581d7a commit e414eeb

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

collections/sample.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { toLength } from "./to_length.ts";
2-
31
const { floor, random } = Math;
42

53
export function sample<T>(arr: ArrayLike<T>): T | undefined {
6-
const length = toLength(arr.length);
4+
const length = arr.length;
75
return length === 0 ? undefined : arr[floor(random() * length)];
86
}

collections/to_length.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ import { toFetch } from "./handler.ts";
44
import { getHandler } from "./server.ts";
55

66
const kv = await Deno.openKv();
7-
export default { fetch: toFetch(getHandler(kv)) };
7+
export default {
8+
fetch: toFetch(getHandler(kv)),
9+
} satisfies Deno.ServeDefaultExport;

0 commit comments

Comments
 (0)