Skip to main content
Module

x/fun/mod.ts>array.isOutOfBounds

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function array.isOutOfBounds
import { array } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { isOutOfBounds } = array;

Given an index and a ReadonlyArray, return true if the index is valid for the given array. This tests whether index is between 0 and arr.length inclusive.

Examples

Example 1

import * as A from "./array.ts";

const arr = A.wrap(1);

const result1 = A.isOutOfBounds(0, arr); // false
const result2 = A.isOutOfBounds(-1, arr); // true
const result3 = A.isOutOfBounds(10, arr); // true

Parameters

index: number
ua: ReadonlyArray<A>

Returns

boolean