UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

25 lines (24 loc) 599 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isEmpty = void 0; const isNullOrUndefined_js_1 = require("./isNullOrUndefined.js"); /** * Checks if a given value is empty */ function isEmpty(value) { if ((0, isNullOrUndefined_js_1.isNullOrUndefined)(value)) { return true; } switch (typeof value) { case 'object': { return !Object.keys(value).length; } case 'string': { return !value.trim(); } default: { return false; } } } exports.isEmpty = isEmpty;