@monstermann/fn
Version:
A utility library for TypeScript.
24 lines (22 loc) • 437 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/map/isEmpty.ts
/**
* `isEmpty(map)`
*
* Checks if `map` is empty (has no entries).
*
* ```ts
* isEmpty(new Map()); // true
* isEmpty(new Map([["a", 1]])); // false
* ```
*
* ```ts
* pipe(new Map(), isEmpty()); // true
* pipe(new Map([["a", 1]]), isEmpty()); // false
* ```
*/
const isEmpty = dfdlT((target) => {
return target.size === 0;
}, 1);
//#endregion
export { isEmpty };