@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
36 lines (34 loc) • 1.08 kB
JavaScript
import { isValidElement } from "react";
//#region src/utils/assertion.ts
/** Is value an array. */
function isArray(value) {
return Array.isArray(value);
}
/** Is value a function. */
function isFunction(value) {
return typeof value === "function";
}
/** Is value JSX / React Element */
function isJsx(value) {
return isValidElement(value);
}
/** Is value a number. */
function isNumber(value) {
return typeof value === "number";
}
/** Is value a regular object (functions, arrays and React elements excluded). */
function isObject(value) {
return !!value && typeof value === "object" && !isFunction(value) && !isArray(value) && !isValidElement(value);
}
/** Is value a valid ReactText - string or number. */
function isReactText(value) {
return isNumber(value) || isString(value);
}
/** Is value a string. */
function isString(value) {
return Object.prototype.toString.call(value) === "[object String]";
}
//#endregion
export { isArray, isFunction, isJsx, isNumber, isObject, isReactText, isString };
globalThis.__vuiVersion__ = "5.3.1"
//# sourceMappingURL=assertion.js.map