--- title: "@std/collections" description: "Pure functions for common tasks related to collection types like arrays and objects" jsr: jsr:@std/collections pkg: collections version: 1.1.6 generated: true stability: stable --- ## Overview

Pure functions for common tasks around collection types like arrays and objects.

Inspired by Kotlin's Collections package and Lodash.

```js 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"}); ``` ### Add to your project ```sh deno add jsr:@std/collections ``` See all symbols in @std/collections on