@rzl-zone/utils-js
Version:
A modern, lightweight set of JavaScript utility functions with TypeScript support for everyday development, crafted to enhance code readability and maintainability.
34 lines (30 loc) • 1.54 kB
JavaScript
/*!
* ====================================================
* Rzl Utils-JS.
* ----------------------------------------------------
* Version: 3.11.0.
* Author: Rizalvin Dwiky.
* Repository: https://github.com/rzl-zone/utils-js.
* ====================================================
*/
;
var chunkWLOQQFDS_cjs = require('./chunk-WLOQQFDS.cjs');
var chunk7FGNVDEV_cjs = require('./chunk-7FGNVDEV.cjs');
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.cjs');
var isEmptyValue = (value, options = {}) => {
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
});
const checkSymbols = chunkSYHPSOUU_cjs.hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
chunkSYHPSOUU_cjs.assertIsBoolean(checkSymbols, {
message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
});
if (chunkSYHPSOUU_cjs.isNil(value) || value === false || chunkSYHPSOUU_cjs.isNaN(value)) return true;
if (chunkSYHPSOUU_cjs.isString(value)) return chunkWLOQQFDS_cjs.isEmptyString(value);
if (chunkSYHPSOUU_cjs.isArray(value)) return chunk7FGNVDEV_cjs.isEmptyArray(value);
if (chunkSYHPSOUU_cjs.isObject(value)) {
return chunk7FGNVDEV_cjs.isEmptyObject(value, { checkSymbols });
}
return false;
};
exports.isEmptyValue = isEmptyValue;