Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dtils/mod.ts>SafeUnknownArray

The best unofficial library of utilities for Deno applications
Go to Latest
class SafeUnknownArray
import { SafeUnknownArray } from "https://deno.land/x/dtils@2.6.0/mod.ts";

Constructors

new
SafeUnknownArray(data: unknown[], contextPath?)

Properties

data: unknown[]
length: number

Methods

forEach(fn: (value: SafeUnknown, index: number) => unknown): void

Calls fn for every item in the array

get(index: number): SafeUnknown

Gets the value of a single index in the array. If the index doesn't exist, a SafeUnknown with null will be returned

map<T>(fn: (value: SafeUnknown, index: number) => T): T[]

Calls fn on each item in the array, returning a new array made up of the results of fn

sureGet(index: number): SafeUnknown

Gets the value of a single index in the array. If the index doesn't exist, an error is thrown

Gets an array of all the values in the array as safe unknowns