Arrays.isEmpty()
Syntax
function isEmpty(iterable: Iterable<unknown> | HasLength | HasSize): boolean
Checks whether an iterable is empty.
| Parameters | |
iterable
|
An iterable with any number of elements. |
Example
import { Arrays } from 'potence';
Arrays.isEmpty([]); // -> true
Arrays.isEmpty([1, 2, 3]); // -> false
Arrays.isEmpty(new Set()); // -> true
Remarks
If the iterable has a length or size property, this function simply checks
whether its value is 0. If the iterable has neither, this function checks
whether its iterator returns any elements. This means that the time complexity
of this function is O(1) for both array-likes and other iterables.
Compare
Arrays.isNotEmpty().