docs(collections): add module example (#4475)

docs(collections): add module docs
This commit is contained in:
Asher Gomez 2024-03-12 16:56:07 +11:00 committed by GitHub
parent 57605ecc0e
commit 48d7fd5b01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -28,6 +28,6 @@ export function filterInPlace<T>(
/**
* Produces a random number between the inclusive `lower` and `upper` bounds.
*/
export function randomInteger(lower: number, upper: number) {
export function randomInteger(lower: number, upper: number): number {
return lower + Math.floor(Math.random() * (upper - lower + 1));
}

View File

@ -9,6 +9,14 @@
* {@link https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/ | Kotlin's Collections}
* package.
*
* ```ts
* import { intersect } from "https://deno.land/std@$STD_VERSION/collections/intersect.ts";
*
* const lisaInterests = ["Cooking", "Music", "Hiking"];
* const kimInterests = ["Music", "Tennis", "Cooking"];
* intersect(lisaInterests, kimInterests); // [ "Cooking", "Music" ]
* ```
*
* @module
*/