????
Current Path : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/@dataui/crud-util/lib/ |
Current File : C:/inetpub/vhost/invest.gdtsolutions.vn/api/node_modules/@dataui/crud-util/lib/checks.util.js |
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isFunction = exports.hasValue = exports.isValue = exports.isDate = exports.isDateString = exports.isNumeric = exports.isBoolean = exports.isIn = exports.isTrue = exports.isFalse = exports.isEqual = exports.isNumber = exports.isObjectFull = exports.isObject = exports.isArrayStrings = exports.isArrayFull = exports.isStringFull = exports.hasLength = exports.isString = exports.isNil = exports.isNull = exports.isUndefined = void 0; const obj_util_1 = require("./obj.util"); const isUndefined = (val) => typeof val === 'undefined'; exports.isUndefined = isUndefined; const isNull = (val) => val === null; exports.isNull = isNull; const isNil = (val) => exports.isUndefined(val) || exports.isNull(val); exports.isNil = isNil; const isString = (val) => typeof val === 'string'; exports.isString = isString; const hasLength = (val) => val.length > 0; exports.hasLength = hasLength; const isStringFull = (val) => exports.isString(val) && exports.hasLength(val); exports.isStringFull = isStringFull; const isArrayFull = (val) => Array.isArray(val) && exports.hasLength(val); exports.isArrayFull = isArrayFull; const isArrayStrings = (val) => exports.isArrayFull(val) && val.every((v) => exports.isStringFull(v)); exports.isArrayStrings = isArrayStrings; const isObject = (val) => typeof val === 'object' && !exports.isNull(val); exports.isObject = isObject; const isObjectFull = (val) => exports.isObject(val) && exports.hasLength(obj_util_1.objKeys(val)); exports.isObjectFull = isObjectFull; const isNumber = (val) => typeof val === 'number' && !Number.isNaN(val) && Number.isFinite(val); exports.isNumber = isNumber; const isEqual = (val, eq) => val === eq; exports.isEqual = isEqual; const isFalse = (val) => val === false; exports.isFalse = isFalse; const isTrue = (val) => val === true; exports.isTrue = isTrue; const isIn = (val, arr = []) => arr.some((o) => exports.isEqual(val, o)); exports.isIn = isIn; const isBoolean = (val) => typeof val === 'boolean'; exports.isBoolean = isBoolean; const isNumeric = (val) => /^[+-]?([0-9]*[.])?[0-9]+$/.test(val); exports.isNumeric = isNumeric; const isDateString = (val) => exports.isStringFull(val) && /^\d{4}-[01]\d-[0-3]\d(?:T[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][0-2]\d(?::?[0-5]\d)?)?)?$/g.test(val); exports.isDateString = isDateString; const isDate = (val) => val instanceof Date; exports.isDate = isDate; const isValue = (val) => exports.isStringFull(val) || exports.isNumber(val) || exports.isBoolean(val) || exports.isDate(val); exports.isValue = isValue; const hasValue = (val) => exports.isArrayFull(val) ? val.every((o) => exports.isValue(o)) : exports.isValue(val); exports.hasValue = hasValue; const isFunction = (val) => typeof val === 'function'; exports.isFunction = isFunction; //# sourceMappingURL=checks.util.js.map