We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8581d7a commit e414eebCopy full SHA for e414eeb
collections/sample.ts
@@ -1,8 +1,6 @@
1
-import { toLength } from "./to_length.ts";
2
-
3
const { floor, random } = Math;
4
5
export function sample<T>(arr: ArrayLike<T>): T | undefined {
6
- const length = toLength(arr.length);
+ const length = arr.length;
7
return length === 0 ? undefined : arr[floor(random() * length)];
8
}
collections/to_length.ts
main.ts
@@ -4,4 +4,6 @@ import { toFetch } from "./handler.ts";
import { getHandler } from "./server.ts";
const kv = await Deno.openKv();
-export default { fetch: toFetch(getHandler(kv)) };
+export default {
+ fetch: toFetch(getHandler(kv)),
9
+} satisfies Deno.ServeDefaultExport;
0 commit comments