Skip to main content
Module

x/scaffold/src/deps/npm.ts>isEmpty

scaffold your next project with style and 💗
Latest
function isEmpty
import { isEmpty } from "https://deno.land/x/scaffold@0.3.0/src/deps/npm.ts";

Check whether an array is empty.

This is useful because doing array.length === 0 on its own won't work as a type-guard.

Examples

Example 1

import {isEmpty} from 'ts-extras';

isEmpty([1, 2, 3]);
//=> false

isEmpty([]);
//=> true

Parameters

array: readonly unknown[]

Returns

array is readonly []

Parameters

array: unknown[]

Returns

array is []