@blinkk/selective-edit
Version:
Selective structured text editor.
51 lines • 1.49 kB
JavaScript
;
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataType = void 0;
/**
* Utility for determining the type of a data value.
*/
class DataType {
static isArray(value) {
if (Array.isArray) {
return Array.isArray(value);
}
return (Boolean(value) && typeof value === 'object' && value.constructor === Array);
}
static isBoolean(value) {
return typeof value === 'boolean';
}
static isDate(value) {
return value instanceof Date;
}
static isFunction(value) {
return typeof value === 'function';
}
static isNumber(value) {
return typeof value === 'number' && isFinite(value);
}
static isNull(value) {
return value === null;
}
static isObject(value) {
return (Boolean(value) &&
typeof value === 'object' &&
value.constructor === Object);
}
static isRegExp(value) {
return (Boolean(value) &&
typeof value === 'object' &&
value.constructor === RegExp);
}
static isString(value) {
return typeof value === 'string' || value instanceof String;
}
static isSymbol(value) {
return typeof value === 'symbol';
}
static isUndefined(value) {
return typeof value === 'undefined';
}
}
exports.DataType = DataType;
//# sourceMappingURL=dataType.js.map