An expensive alternative to basic arrays in TypeScript. Includes various methods and properties to make List manipulation easy, chainable, and readable.
This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Bun




JSR Score
70%
Published
a year ago (0.3.5)
This module provides a list data structure, which can be used instead of an array. A list is more computationally expensive than a regular array, but contains various methods and properties, which make manipulating list data simple, chainable, and readable.
Example 1
Example 1
import { List } from "@exts/list"; const myList = new List(10, 20, 30, 40); myList.push(50); console.log(myList.last) // 50 console.log(myList.indexOfLast) // 4 // explicit return typing is necessary for some methods // because TypeScript cannot infer the type of `item` from the type of `item.value` myList.find((item): item is Item<number> => item.value > 10)!.value // 20 myList.find((item): item is Item<number> => item.value > 10)!.index // 1 // skip the first found item myList.find((item): item is Item<number> => item.value > 10, 1)!.value // 30 myList.fromUntil(item => item.value === 10, item => item.value === 30) .values // [10, 20, 30]
Add Package
deno add jsr:@exts/list
Import symbol
import * as list from "@exts/list";
Import directly with a jsr specifier
import * as list from "jsr:@exts/list";
Add Package
pnpm i jsr:@exts/list
pnpm dlx jsr add @exts/list
Import symbol
import * as list from "@exts/list";
Add Package
yarn add jsr:@exts/list
yarn dlx jsr add @exts/list
Import symbol
import * as list from "@exts/list";
Add Package
vlt install jsr:@exts/list
Import symbol
import * as list from "@exts/list";
Add Package
npx jsr add @exts/list
Import symbol
import * as list from "@exts/list";
Add Package
bunx jsr add @exts/list
Import symbol
import * as list from "@exts/list";