Skip to main content
Module

x/dtils/mod.unstable.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.5.0/mod.unstable.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