assertion.js
1 "use strict"; 2 var __defProp = Object.defineProperty; 3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 var __getOwnPropNames = Object.getOwnPropertyNames; 5 var __hasOwnProp = Object.prototype.hasOwnProperty; 6 var __export = (target, all) => { 7 for (var name in all) 8 __defProp(target, name, { get: all[name], enumerable: true }); 9 }; 10 var __copyProps = (to, from, except, desc) => { 11 if (from && typeof from === "object" || typeof from === "function") { 12 for (let key of __getOwnPropNames(from)) 13 if (!__hasOwnProp.call(to, key) && key !== except) 14 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 15 } 16 return to; 17 }; 18 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 19 20 // src/assertion.ts 21 var assertion_exports = {}; 22 __export(assertion_exports, { 23 __DEV__: () => __DEV__, 24 __TEST__: () => __TEST__, 25 dataAttr: () => dataAttr, 26 isArray: () => isArray, 27 isEmpty: () => isEmpty, 28 isEmptyArray: () => isEmptyArray, 29 isEmptyObject: () => isEmptyObject, 30 isFunction: () => isFunction, 31 isNumeric: () => isNumeric, 32 isObject: () => isObject 33 }); 34 module.exports = __toCommonJS(assertion_exports); 35 var __DEV__ = process.env.NODE_ENV !== "production"; 36 var __TEST__ = process.env.NODE_ENV === "test"; 37 function isArray(value) { 38 return Array.isArray(value); 39 } 40 function isEmptyArray(value) { 41 return isArray(value) && value.length === 0; 42 } 43 function isObject(value) { 44 const type = typeof value; 45 return value != null && (type === "object" || type === "function") && !isArray(value); 46 } 47 function isEmptyObject(value) { 48 return isObject(value) && Object.keys(value).length === 0; 49 } 50 function isEmpty(value) { 51 if (isArray(value)) 52 return isEmptyArray(value); 53 if (isObject(value)) 54 return isEmptyObject(value); 55 if (value == null || value === "") 56 return true; 57 return false; 58 } 59 function isFunction(value) { 60 return typeof value === "function"; 61 } 62 var dataAttr = (condition) => condition ? "true" : void 0; 63 var isNumeric = (value) => value != null && parseInt(value.toString(), 10) > 0; 64 // Annotate the CommonJS export names for ESM import in node: 65 0 && (module.exports = { 66 __DEV__, 67 __TEST__, 68 dataAttr, 69 isArray, 70 isEmpty, 71 isEmptyArray, 72 isEmptyObject, 73 isFunction, 74 isNumeric, 75 isObject 76 });