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 Set contains any element
*
* @example
* Returns `true` if the Set is empty
* ```ts
* const result = isEmpty(new Set());
* console.log(result); // true
* ```
*
* @example
* Returns `false` if the Set contains elements
* ```ts
* const result = isEmpty(new Set([1]));
* console.log(result); // false
* ```
*
* @param set - the {@link Set} to check
* @returns `true` if the Set is empty, otherwise `false`
*/
export const isEmpty = (set: ReadonlySet<unknown>): boolean => {
return !set.size;
};
|