Files

39 lines
890 B
JavaScript
Raw Permalink Normal View History

2026-02-10 08:05:03 +08:00
export function isFunction(val) {
return typeof val === 'function';
}
export const isString = val => typeof val === 'string';
export const isNull = value => value === null;
export const isUndefined = value => value === undefined;
export function isDef(value) {
return !isUndefined(value) && !isNull(value);
}
export function isInteger(value) {
return Number.isInteger(value);
}
export function isNumeric(value) {
return !Number.isNaN(Number(value));
}
export function isNumber(value) {
return typeof value === 'number';
}
export function isBoolean(value) {
return typeof value === 'boolean';
}
export function isObject(x) {
const type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
export function isPlainObject(val) {
return val !== null && typeof val === 'object' && Object.prototype.toString.call(val) === '[object Object]';
}