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

x/arrays/mod.ts>Arrays.isType

Provides utility methods for common Array operations
Latest
function Arrays.isType
import { Arrays } from "https://deno.land/x/arrays@v1.0.21/mod.ts";
const { isType } = Arrays;

Flattens an array and checks if all the elements are of the specified type.

import 'https://deno.land/x/arrays/mod.ts'

const arr = [['dog', ['sun', 'sky'], 'moon'], 'test']
const isValid = arr.isType('number')
// => false

Parameters

array: Array<any>
  • Type to match
type: string

Returns

Boolean