UNPKG

@xtsai/xai-utils

Version:

The xai-utils is an openai nodejs sdk compatible extension library.

36 lines 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isConfigYes = exports.isInvalidDate = void 0; exports.isNumber = isNumber; exports.isString = isString; exports.isNotEmptyString = isNotEmptyString; exports.isBoolean = isBoolean; exports.isFunction = isFunction; function isNumber(value) { return Object.prototype.toString.call(value) === '[object Number]'; } function isString(value) { return Object.prototype.toString.call(value) === '[object String]'; } function isNotEmptyString(value) { return typeof value === 'string' && value.length > 0; } function isBoolean(value) { return Object.prototype.toString.call(value) === '[object Boolean]'; } function isFunction(value) { return Object.prototype.toString.call(value) === '[object Function]'; } const isInvalidDate = (d) => { if (typeof d === 'undefined') return true; if (new Date(d).toString() === 'Invalid Date') return true; return false; }; exports.isInvalidDate = isInvalidDate; const CNF_PROP_VOLUME_YES = ['1', 1, 'on', 'y', 'yes', 'true', true]; const isConfigYes = (v) => CNF_PROP_VOLUME_YES.includes(v) || CNF_PROP_VOLUME_YES.includes(String(v).toLocaleLowerCase()); exports.isConfigYes = isConfigYes; //# sourceMappingURL=is.js.map