GuardsPrimitive Type Guards
Composite Type Guards
Runtime type guards to validate composite primitive values.
Runtime type guards to validate composite primitive values.
Imports
import { isPrimitive, isNormalPrimitive, isNonEmptyString, isFalsy, isTruthy } from 'toolbox-x/guards';isPrimitive
Validates if a value is a JavaScript primitive. It covers string | number | boolean | symbol | bigint | null | undefined
Signature
isPrimitive(value: unknown): value is PrimitiveExamples
playground.ts
isNormalPrimitive
Validates if a value is a normal JavaScript primitive. It covers string | number | boolean | null | undefined
Signature
isNormalPrimitive(value: unknown): value is NormalPrimitiveExamples
playground.ts
isNonEmptyString
Validates if a value is a non-empty string.
Signature
function isNonEmptyString(value: unknown): value is stringExamples
playground.ts
isFalsy
Validates if a value is falsy.
Signature
isFalsy(value: unknown): value is FalsyPrimitiveExamples
playground.ts
isTruthy
Validates if a value is truthy.
Signature
isTruthy<T>(value: T): value is Exclude<T, FalsyPrimitive>Examples
playground.ts
Last updated: Sat, Jun 06, 2026 09:29:26AM (UTC)
