Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 2x 2x | /**
* Checks if a {@link Map} contains any entry
*
* @example
* Returns `true` if the {@link Map} is empty
* ```ts
* const result = isEmpty(new Map());
* console.log(result); // true
* ```
*
* @example
* Returns `false` if the {@link Map} contains elements
* ```ts
* const result = isEmpty(new Map([[1, 2]]));
* console.log(result); // false
* ```
*
* @param map - the {@link Map} to check
* @returns `true` if the {@link Map} is empty, otherwise `false`
*/
export const isEmpty = (map: ReadonlyMap<unknown, unknown>): boolean => {
return !map.size;
};
|