@std/collections
Обзор
Чистые функции для распространённых задач с коллекциями, такими как массивы и объекты.
Вдохновлено пакетом Коллекции Kotlin и библиотекой Lodash.
import { intersect, sample, pick } from "@std/collections";
import { assertEquals, assertArrayIncludes } from "@std/assert";
const lisaInterests = ["Cooking", "Music", "Hiking"];
const kimInterests = ["Music", "Tennis", "Cooking"];
assertEquals(intersect(lisaInterests, kimInterests), ["Cooking", "Music"]);
assertArrayIncludes(lisaInterests, [sample(lisaInterests)]);
const cat = { name: "Lulu", age: 3, breed: "Ragdoll" };
assertEquals(pick(cat, ["name", "breed"]), { name: "Lulu", breed: "Ragdoll"});
Добавьте в свой проект
›_
deno add jsr:@std/collections
© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/runtime/reference/std/collections