@monstermann/fn
Version:
A utility library for TypeScript.
25 lines (23 loc) • 446 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
//#region src/object/isEmpty.ts
/**
* `isEmpty(target)`
*
* Checks if `target` object has no enumerable properties.
*
* ```ts
* isEmpty({}); // true
* isEmpty({ a: 1 }); // false
* ```
*
* ```ts
* pipe({}, isEmpty()); // true
* pipe({ a: 1 }, isEmpty()); // false
* ```
*/
const isEmpty = dfdlT((target) => {
for (const _ in target) return false;
return true;
}, 1);
//#endregion
export { isEmpty };