# @helpers4/type

> Tree-shakable TypeScript utility functions for the `type` domain.
> Package: `@helpers4/type` — Version: 2.0.1
> License: LGPL-3.0-or-later

## Installation

```sh
npm install @helpers4/type
# or
pnpm add @helpers4/type
```

## Usage

```typescript
import { isArray, isArrayBuffer, isAsyncFunction, ... } from '@helpers4/type';
```

## Functions

| Function | Description |
|---|---|
| `isArray` | Checks if a value is an array. |
| `isArrayBuffer` | Checks if a value is an ArrayBuffer instance.  Useful for filtering or type-narrowing in a functiona |
| `isAsyncFunction` | Checks if a value is an async function.  Returns `true` for any function declared with `async`. |
| `isBigInt` | Checks if a value is a bigint. |
| `isBlob` | Checks if a value is a Blob instance.  Useful for filtering or type-narrowing in a functional pipeli |
| `isBoolean` | Checks if a value is a boolean. |
| `isDate` | Checks if a value is a Date instance.  Note: this only checks the type, not whether the Date is vali |
| `isDefined` | Checks if a value is defined (not undefined nor null). This is the inverse of isNullish.  Use as a t |
| `isEmpty` | Checks if a value is empty.  Supported types: - `null` / `undefined` → empty - `string` → length === |
| `isError` | Checks if a value is an Error instance. |
| `isFalsy` | Checks if a value is falsy (`false`, `null`, `undefined`, `0`, `""`, `NaN`). |
| `isFormData` | Checks if a value is a FormData instance.  Useful for filtering or type-narrowing in a functional pi |
| `isFunction` | Checks if a value is a function. |
| `isIterable` | Checks if a value is iterable (has a `Symbol.iterator` method).  Returns `true` for strings, arrays, |
| `isMap` | Checks if a value is a Map instance. |
| `isNegativeNumber` | Checks if a value is a number less than 0.  Returns `false` for `NaN`, `0`, positive numbers, and no |
| `isNonEmptyArray` | Checks if a value is a non-empty array (length > 0). |
| `isNonEmptyString` | Checks if a value is a non-empty string (length > 0). |
| `isNull` | Checks if a value is `null`. |
| `isNullish` | Checks if a value is null or undefined (nullish). |
| `isNumber` | Checks if a value is a number.  Returns `false` for `NaN`, which intentionally deviates from `typeof |
| `isPlainObject` | Checks if a value is a plain object.  A plain object is created by `{}`, `new Object()`, or `Object. |
| `isPositiveNumber` | Checks if a value is a number greater than 0.  Returns `false` for `NaN`, `0`, negative numbers, and |
| `isPrimitive` | Checks if a value is a JavaScript primitive.  Primitive types: `string`, `number`, `boolean`, `bigin |
| `isPromise` | Checks if a value is a Promise or a thenable.  Returns `true` for any object that has `.then()` and  |
| `isRegExp` | Checks if a value is a RegExp instance. |
| `isSpecialObject` | Determines if a value is a special object that should not have its properties compared deeply. Speci |
| `isString` | Checks if a value is a string. |
| `isSymbol` | Checks if a value is a symbol. |
| `isTemporalDuration` | Checks if a value is a `Temporal.Duration`.  Uses `instanceof` when `Temporal` is available globally |
| `isTemporalInstant` | Checks if a value is a `Temporal.Instant`.  Uses `instanceof` when `Temporal` is available globally, |
| `isTemporalPlainDate` | Checks if a value is a `Temporal.PlainDate`.  Uses `instanceof` when `Temporal` is available globall |
| `isTemporalPlainDateTime` | Checks if a value is a `Temporal.PlainDateTime`.  Uses `instanceof` when `Temporal` is available glo |
| `isTemporalPlainTime` | Checks if a value is a `Temporal.PlainTime`.  Uses `instanceof` when `Temporal` is available globall |
| `isTemporalZonedDateTime` | Checks if a value is a `Temporal.ZonedDateTime`.  Uses `instanceof` when `Temporal` is available glo |
| `isTimestamp` | Checks if a value is a valid timestamp (milliseconds or Unix seconds).  Supports: - JavaScript / Jav |
| `isTruthy` | Checks if a value is truthy (not `false`, `null`, `undefined`, `0`, `""`, or `NaN`).  This is the ty |
| `isUndefined` | Checks if a value is `undefined`. |
| `isValidDate` | Checks if a value is a valid Date instance (not `Invalid Date`).  Unlike isDate, this also verifies  |
| `isValidRegex` | Checks if a string is a valid regex pattern. |

---

## API Reference

### `isArray`

Checks if a value is an array.

```typescript
import { isArray } from '@helpers4/type';

isArray(value: unknown): value is unknown[]
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is unknown[]` — True if value is an array

**Examples:**

*isArray*

```typescript
```ts
isArray([1, 2, 3]) // => true
isArray('hello')   // => false
isArray({})        // => false
```
```

---

### `isArrayBuffer`

Checks if a value is an ArrayBuffer instance.

Useful for filtering or type-narrowing in a functional pipeline:
`values.filter(isArrayBuffer)`

```typescript
import { isArrayBuffer } from '@helpers4/type';

isArrayBuffer(value: unknown): value is ArrayBuffer
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is ArrayBuffer` — True if value is an ArrayBuffer

**Examples:**

*Detect an ArrayBuffer*

Returns true only for ArrayBuffer instances, not TypedArray views.

```typescript
isArrayBuffer(new ArrayBuffer(8)) // => true
isArrayBuffer(new Uint8Array(8))  // => false
isArrayBuffer('hello')            // => false
```

*Filter ArrayBuffers from a mixed array*

Use as a predicate in .filter() to extract ArrayBuffer values.

```typescript
const values = [new ArrayBuffer(4), 'text', new ArrayBuffer(8), 42];
values.filter(isArrayBuffer)
// => [ArrayBuffer(4), ArrayBuffer(8)]
```

---

### `isAsyncFunction`

Checks if a value is an async function.

Returns `true` for any function declared with `async`.

```typescript
import { isAsyncFunction } from '@helpers4/type';

isAsyncFunction(value: unknown): value is function
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is function` — True if value is an async function

**Examples:**

*isAsyncFunction*

```typescript
```ts
isAsyncFunction(async () => {})      // => true
isAsyncFunction(async function() {}) // => true
isAsyncFunction(() => {})            // => false
isAsyncFunction(42)                  // => false
```
```

---

### `isBigInt`

Checks if a value is a bigint.

```typescript
import { isBigInt } from '@helpers4/type';

isBigInt(value: unknown): value is bigint
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is bigint` — True if value is a bigint

**Examples:**

*isBigInt*

```typescript
```ts
isBigInt(42n)  // => true
isBigInt(42)   // => false
isBigInt('42') // => false
```
```

---

### `isBlob`

Checks if a value is a Blob instance.

Useful for filtering or type-narrowing in a functional pipeline:
`values.filter(isBlob)`

```typescript
import { isBlob } from '@helpers4/type';

isBlob(value: unknown): value is Blob
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Blob` — True if value is a Blob

**Examples:**

*Detect a Blob*

Returns true only for Blob instances.

```typescript
isBlob(new Blob(['hello'])) // => true
isBlob(new Blob([], { type: 'application/json' })) // => true
isBlob('hello')             // => false
```

*Filter Blobs from a mixed array*

Use as a predicate in .filter() to extract Blob values.

```typescript
const values = [new Blob(['a']), 'text', new Blob(['b']), 42];
values.filter(isBlob)
// => [Blob, Blob]
```

---

### `isBoolean`

Checks if a value is a boolean.

```typescript
import { isBoolean } from '@helpers4/type';

isBoolean(value: unknown): value is boolean
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is boolean` — True if value is a boolean

**Examples:**

*isBoolean*

```typescript
```ts
isBoolean(true)  // => true
isBoolean(false) // => true
isBoolean(1)     // => false
```
```

---

### `isDate`

Checks if a value is a Date instance.

Note: this only checks the type, not whether the Date is valid.
Use isValidDate to also validate that the Date is not `Invalid Date`.

```typescript
import { isDate } from '@helpers4/type';

isDate(value: unknown): value is Date
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Date` — True if value is a Date instance

**Examples:**

*isDate*

```typescript
```ts
isDate(new Date())          // => true
isDate(new Date('invalid')) // => true (still a Date instance)
isDate('2023-01-01')       // => false
isDate(1609459200000)      // => false
```
```

---

### `isDefined`

Checks if a value is defined (not undefined nor null).
This is the inverse of isNullish.

Use as a type-safe filter callback to remove `null`/`undefined` from arrays.

```typescript
import { isDefined } from '@helpers4/type';

isDefined<T>(value: Maybe<T>): value is T
```

**Parameters:**

- `value: Maybe<T>` — The value to check

**Returns:** `value is T` — True if value is not undefined nor null

**Examples:**

*isDefined*

```typescript
```ts
isDefined(42)        // => true
isDefined('')        // => true (empty string is defined)
isDefined(null)      // => false
isDefined(undefined) // => false
```
```

*isDefined*

```typescript
```ts
// Type-safe alternative to filter out null/undefined
const items: (string | null | undefined)[] = ['a', null, 'b', undefined];
const result = items.filter(isDefined);
// => ['a', 'b'] with type string[]
```
```

---

### `isEmpty`

Checks if a value is empty.

Supported types:
- `null` / `undefined` → empty
- `string` → length === 0
- `array` → length === 0
- `Map` / `Set` → size === 0
- plain object → no own enumerable properties

```typescript
import { isEmpty } from '@helpers4/type';

isEmpty(value: unknown): value is "" | never[] | ReadonlyMap<never, never> | ReadonlySet<never> | null | undefined
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is "" | never[] | ReadonlyMap<never, never> | ReadonlySet<never> | null | undefined` — `true` if the value is considered empty, `false` otherwise.
Acts as a type guard: the `else` branch narrows away `null`, `undefined`,
empty strings, empty arrays, and empty Map/Set.
Plain empty objects (`{}`) are not representable as a distinct type in
TypeScript and are therefore not part of the predicate.

**Examples:**

*Check empty values*

Returns true for null, undefined, empty strings, arrays, objects, Maps, and Sets.

```typescript
isEmpty('')     // => true
isEmpty([])     // => true
isEmpty({})     // => true
isEmpty(null)   // => true
```

*Non-empty values*

Returns false for values with content.

```typescript
isEmpty('hello') // => false
isEmpty([1])     // => false
isEmpty(42)      // => false
```

---

### `isError`

Checks if a value is an Error instance.

```typescript
import { isError } from '@helpers4/type';

isError(value: unknown): value is Error
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Error` — True if value is an Error (or subclass like TypeError, RangeError, etc.)

**Examples:**

*isError*

```typescript
```ts
isError(new Error('oops'))     // => true
isError(new TypeError('bad'))  // => true
isError({ message: 'fake' })  // => false
```
```

---

### `isFalsy`

Checks if a value is falsy (`false`, `null`, `undefined`, `0`, `""`, `NaN`).

```typescript
import { isFalsy } from '@helpers4/type';

isFalsy(value: unknown): value is Falsy
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Falsy` — True if the value is falsy

**Examples:**

*Check falsy values*

Returns true for all falsy values: false, null, undefined, 0, "", NaN.

```typescript
isFalsy(0)         // => true
isFalsy('')        // => true
isFalsy(null)      // => true
isFalsy('hello')   // => false
```

---

### `isFormData`

Checks if a value is a FormData instance.

Useful for filtering or type-narrowing in a functional pipeline:
`values.filter(isFormData)`

```typescript
import { isFormData } from '@helpers4/type';

isFormData(value: unknown): value is FormData
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is FormData` — True if value is a FormData

**Examples:**

*Detect a FormData*

Returns true only for FormData instances.

```typescript
isFormData(new FormData()) // => true
isFormData({})             // => false
isFormData(null)           // => false
```

*Filter FormData from a mixed array*

Use as a predicate in .filter() to extract FormData values.

```typescript
const fd = new FormData();
fd.append('name', 'Alice');
const values = [fd, {}, new FormData(), 'text'];
values.filter(isFormData)
// => [FormData, FormData]
```

---

### `isFunction`

Checks if a value is a function.

```typescript
import { isFunction } from '@helpers4/type';

isFunction(value: unknown): value is Function
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Function` — True if value is a function

**Examples:**

*isFunction*

```typescript
```ts
isFunction(() => {})       // => true
isFunction(function() {})  // => true
isFunction('function')     // => false
```
```

---

### `isIterable`

Checks if a value is iterable (has a `Symbol.iterator` method).

Returns `true` for strings, arrays, Maps, Sets, generators, and any object
implementing the iterable protocol.

```typescript
import { isIterable } from '@helpers4/type';

isIterable(value: unknown): value is Iterable<unknown, any, any>
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Iterable<unknown, any, any>` — True if value is iterable

**Examples:**

*isIterable*

```typescript
```ts
isIterable([1, 2, 3])      // => true
isIterable('hello')        // => true
isIterable(new Map())      // => true
isIterable(new Set())      // => true
isIterable({})             // => false
isIterable(42)             // => false
```
```

---

### `isMap`

Checks if a value is a Map instance.

```typescript
import { isMap } from '@helpers4/type';

isMap(value: unknown): value is Map<unknown, unknown>
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Map<unknown, unknown>` — True if value is a Map

**Examples:**

*isMap*

```typescript
```ts
isMap(new Map())           // => true
isMap(new Map([['a', 1]])) // => true
isMap({})                  // => false
```
```

---

### `isNegativeNumber`

Checks if a value is a number less than 0.

Returns `false` for `NaN`, `0`, positive numbers, and non-number types.

```typescript
import { isNegativeNumber } from '@helpers4/type';

isNegativeNumber(value: unknown): value is number
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is number` — True if value is a negative number

**Examples:**

*isNegativeNumber*

```typescript
```ts
isNegativeNumber(-1)   // => true
isNegativeNumber(-0.5) // => true
isNegativeNumber(0)    // => false
isNegativeNumber(1)    // => false
isNegativeNumber(NaN)  // => false
```
```

---

### `isNonEmptyArray`

Checks if a value is a non-empty array (length > 0).

```typescript
import { isNonEmptyArray } from '@helpers4/type';

isNonEmptyArray(value: unknown): value is [unknown, rest]
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is [unknown, rest]` — True if value is an array with at least one element

**Examples:**

*isNonEmptyArray*

```typescript
```ts
isNonEmptyArray([1, 2]) // => true
isNonEmptyArray([])     // => false
isNonEmptyArray('abc')  // => false
isNonEmptyArray(null)   // => false
```
```

---

### `isNonEmptyString`

Checks if a value is a non-empty string (length > 0).

```typescript
import { isNonEmptyString } from '@helpers4/type';

isNonEmptyString(value: unknown): value is string
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is string` — True if value is a string with at least one character

**Examples:**

*isNonEmptyString*

```typescript
```ts
isNonEmptyString('hello') // => true
isNonEmptyString('')      // => false
isNonEmptyString(42)      // => false
isNonEmptyString(null)    // => false
```
```

---

### `isNull`

Checks if a value is `null`.

```typescript
import { isNull } from '@helpers4/type';

isNull(value: unknown): value is null
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is null` — True if value is null

**Examples:**

*isNull*

```typescript
```ts
isNull(null)      // => true
isNull(undefined) // => false
isNull(0)         // => false
```
```

---

### `isNullish`

Checks if a value is null or undefined (nullish).

```typescript
import { isNullish } from '@helpers4/type';

isNullish(value: unknown): value is null | undefined
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is null | undefined` — True if value is null or undefined

**Examples:**

*Check for null or undefined*

Returns true only for null and undefined, not other falsy values.

```typescript
isNullish(null)      // => true
isNullish(undefined) // => true
isNullish(0)         // => false
isNullish('')        // => false
```

*Guard before accessing properties*

Use as a type guard to safely narrow types.

```typescript
function greet(name: string | null | undefined): string {
  if (isNullish(name)) return 'Hello, stranger!';
  return `Hello, ${name}!`;
}
greet(null) // => 'Hello, stranger!'
```

---

### `isNumber`

Checks if a value is a number.

Returns `false` for `NaN`, which intentionally deviates from `typeof` behavior
to increase user-friendliness.

```typescript
import { isNumber } from '@helpers4/type';

isNumber(value: unknown): value is number
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is number` — True if value is a number (excludes NaN)

**Examples:**

*isNumber*

```typescript
```ts
isNumber(42)    // => true
isNumber(0)     // => true
isNumber(NaN)   // => false
isNumber('123') // => false
```
```

---

### `isPlainObject`

Checks if a value is a plain object.

A plain object is created by `{}`, `new Object()`, or `Object.create(null)`.
Returns `false` for arrays, Date, Map, Set, RegExp, class instances, etc.

```typescript
import { isPlainObject } from '@helpers4/type';

isPlainObject(value: unknown): value is Record<string, unknown>
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Record<string, unknown>` — True if value is a plain object

**Examples:**

*isPlainObject*

```typescript
```ts
isPlainObject({})           // => true
isPlainObject({ a: 1 })    // => true
isPlainObject(new Date())  // => false
isPlainObject([])          // => false
isPlainObject(null)        // => false
```
```

---

### `isPositiveNumber`

Checks if a value is a number greater than 0.

Returns `false` for `NaN`, `0`, negative numbers, and non-number types.

```typescript
import { isPositiveNumber } from '@helpers4/type';

isPositiveNumber(value: unknown): value is number
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is number` — True if value is a positive number

**Examples:**

*isPositiveNumber*

```typescript
```ts
isPositiveNumber(42)   // => true
isPositiveNumber(0.1)  // => true
isPositiveNumber(0)    // => false
isPositiveNumber(-1)   // => false
isPositiveNumber(NaN)  // => false
```
```

---

### `isPrimitive`

Checks if a value is a JavaScript primitive.

Primitive types: `string`, `number`, `boolean`, `bigint`, `symbol`, `null`, `undefined`.

```typescript
import { isPrimitive } from '@helpers4/type';

isPrimitive(value: unknown): value is Primitive
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Primitive` — True if value is a primitive

**Examples:**

*isPrimitive*

```typescript
```ts
isPrimitive('hello')  // => true
isPrimitive(42)       // => true
isPrimitive(null)     // => true
isPrimitive({})       // => false
isPrimitive([])       // => false
```
```

---

### `isPromise`

Checks if a value is a Promise or a thenable.

Returns `true` for any object that has `.then()` and `.catch()` methods,
including native Promises and userland implementations.

```typescript
import { isPromise } from '@helpers4/type';

isPromise(value: unknown): value is PromiseLike<unknown>
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is PromiseLike<unknown>` — True if value is a Promise-like object

**Examples:**

*isPromise*

```typescript
```ts
isPromise(Promise.resolve(42))     // => true
isPromise(new Promise(() => {}))   // => true
isPromise({ then: () => {} })      // => false (no .catch)
isPromise(42)                      // => false
```
```

---

### `isRegExp`

Checks if a value is a RegExp instance.

```typescript
import { isRegExp } from '@helpers4/type';

isRegExp(value: unknown): value is RegExp
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is RegExp` — True if value is a RegExp

**Examples:**

*isRegExp*

```typescript
```ts
isRegExp(/abc/)          // => true
isRegExp(new RegExp('a')) // => true
isRegExp('abc')          // => false
```
```

---

### `isSpecialObject`

Determines if a value is a special object that should not have its properties compared deeply.
Special objects include: Date, Function, Promise, Observable, RegExp, Error, Map, Set, WeakMap, WeakSet, etc.

```typescript
import { isSpecialObject } from '@helpers4/type';

isSpecialObject(value: unknown): boolean
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `boolean` — `true` if the value is a special object, `false` otherwise

**Examples:**

*Detect special objects*

Returns true for built-in objects like Date, Map, Set, RegExp, etc.

```typescript
isSpecialObject(new Date())     // => true
isSpecialObject(new Map())      // => true
isSpecialObject(/regex/)        // => true
```

*Plain objects are not special*

Returns false for plain objects and arrays.

```typescript
isSpecialObject({ a: 1 })  // => false
isSpecialObject([1, 2])    // => false
```

---

### `isString`

Checks if a value is a string.

```typescript
import { isString } from '@helpers4/type';

isString(value: unknown): value is string
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is string` — True if value is a string

**Examples:**

*isString*

```typescript
```ts
isString('hello') // => true
isString(123)     // => false
```
```

---

### `isSymbol`

Checks if a value is a symbol.

```typescript
import { isSymbol } from '@helpers4/type';

isSymbol(value: unknown): value is symbol
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is symbol` — True if value is a symbol

**Examples:**

*isSymbol*

```typescript
```ts
isSymbol(Symbol('test')) // => true
isSymbol(Symbol.iterator) // => true
isSymbol('symbol')       // => false
```
```

---

### `isTemporalDuration`

Checks if a value is a `Temporal.Duration`.

Uses `instanceof` when `Temporal` is available globally, and falls back
to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).

```typescript
import { isTemporalDuration } from '@helpers4/type';

isTemporalDuration(value: unknown): value is Duration
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Duration` — True if value is a `Temporal.Duration`

**Examples:**

*isTemporalDuration*

```typescript
```ts
isTemporalDuration(Temporal.Duration.from({ hours: 1 }))  // => true
isTemporalDuration(Temporal.Now.instant())                 // => false
isTemporalDuration(1000)                                   // => false
```
```

---

### `isTemporalInstant`

Checks if a value is a `Temporal.Instant`.

Uses `instanceof` when `Temporal` is available globally, and falls back
to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).

```typescript
import { isTemporalInstant } from '@helpers4/type';

isTemporalInstant(value: unknown): value is Instant
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Instant` — True if value is a `Temporal.Instant`

**Examples:**

*isTemporalInstant*

```typescript
```ts
isTemporalInstant(Temporal.Now.instant())      // => true
isTemporalInstant(Temporal.Now.plainDateISO())  // => false
isTemporalInstant(new Date())                   // => false
```
```

---

### `isTemporalPlainDate`

Checks if a value is a `Temporal.PlainDate`.

Uses `instanceof` when `Temporal` is available globally, and falls back
to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).

```typescript
import { isTemporalPlainDate } from '@helpers4/type';

isTemporalPlainDate(value: unknown): value is PlainDate
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is PlainDate` — True if value is a `Temporal.PlainDate`

**Examples:**

*isTemporalPlainDate*

```typescript
```ts
isTemporalPlainDate(Temporal.PlainDate.from('2025-01-19'))  // => true
isTemporalPlainDate(Temporal.Now.instant())                 // => false
isTemporalPlainDate(new Date())                             // => false
```
```

---

### `isTemporalPlainDateTime`

Checks if a value is a `Temporal.PlainDateTime`.

Uses `instanceof` when `Temporal` is available globally, and falls back
to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).

```typescript
import { isTemporalPlainDateTime } from '@helpers4/type';

isTemporalPlainDateTime(value: unknown): value is PlainDateTime
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is PlainDateTime` — True if value is a `Temporal.PlainDateTime`

**Examples:**

*isTemporalPlainDateTime*

```typescript
```ts
isTemporalPlainDateTime(Temporal.PlainDateTime.from('2025-01-19T12:00'))  // => true
isTemporalPlainDateTime(Temporal.Now.instant())                           // => false
isTemporalPlainDateTime(new Date())                                       // => false
```
```

---

### `isTemporalPlainTime`

Checks if a value is a `Temporal.PlainTime`.

Uses `instanceof` when `Temporal` is available globally, and falls back
to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).

```typescript
import { isTemporalPlainTime } from '@helpers4/type';

isTemporalPlainTime(value: unknown): value is PlainTime
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is PlainTime` — True if value is a `Temporal.PlainTime`

**Examples:**

*isTemporalPlainTime*

```typescript
```ts
isTemporalPlainTime(Temporal.PlainTime.from('12:30:00'))  // => true
isTemporalPlainTime(Temporal.Now.instant())               // => false
isTemporalPlainTime(new Date())                           // => false
```
```

---

### `isTemporalZonedDateTime`

Checks if a value is a `Temporal.ZonedDateTime`.

Uses `instanceof` when `Temporal` is available globally, and falls back
to `Symbol.toStringTag` for environments without Temporal (e.g. browsers).

```typescript
import { isTemporalZonedDateTime } from '@helpers4/type';

isTemporalZonedDateTime(value: unknown): value is ZonedDateTime
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is ZonedDateTime` — True if value is a `Temporal.ZonedDateTime`

**Examples:**

*isTemporalZonedDateTime*

```typescript
```ts
isTemporalZonedDateTime(Temporal.Now.zonedDateTimeISO())  // => true
isTemporalZonedDateTime(Temporal.Now.instant())           // => false
isTemporalZonedDateTime(new Date())                       // => false
```
```

---

### `isTimestamp`

Checks if a value is a valid timestamp (milliseconds or Unix seconds).

Supports:
- JavaScript / Java timestamps (milliseconds since epoch)
- Unix timestamps (seconds since epoch)

The function uses a heuristic to distinguish between the two:
numbers ≤ ~7.26 billion are treated as seconds, larger as milliseconds.

```typescript
import { isTimestamp } from '@helpers4/type';

isTimestamp(value: unknown): value is number
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is number` — True if value is a number that represents a valid timestamp

**Examples:**

*isTimestamp*

```typescript
```ts
isTimestamp(1609459200000) // => true (JS ms — 2021-01-01)
isTimestamp(1609459200)    // => true (Unix seconds — 2021-01-01)
isTimestamp(Date.now())    // => true
isTimestamp(NaN)           // => false
isTimestamp('1609459200')  // => false (not a number)
```
```

---

### `isTruthy`

Checks if a value is truthy (not `false`, `null`, `undefined`, `0`, `""`, or `NaN`).

This is the type-safe alternative to `Boolean()` as a filter callback.
Unlike `filter(Boolean)`, using `filter(isTruthy)` correctly narrows the
resulting array type by excluding falsy values.

```typescript
import { isTruthy } from '@helpers4/type';

isTruthy<T>(value: Falsy | T): value is T
```

**Parameters:**

- `value: Falsy | T` — The value to check

**Returns:** `value is T` — True if the value is truthy

**Examples:**

*Check truthy values*

Returns true for all truthy values, false for falsy ones.

```typescript
isTruthy(1)         // => true
isTruthy('hello')   // => true
isTruthy(0)         // => false
isTruthy(null)      // => false
```

*Type-safe filter alternative to Boolean*

Use isTruthy with Array.filter to get correct TypeScript narrowing.

```typescript
const items = ['a', '', null, 'b', undefined];
const result = items.filter(isTruthy);
// => ['a', 'b'] with type string[]
```

---

### `isUndefined`

Checks if a value is `undefined`.

```typescript
import { isUndefined } from '@helpers4/type';

isUndefined(value: unknown): value is undefined
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is undefined` — True if value is undefined

**Examples:**

*isUndefined*

```typescript
```ts
isUndefined(undefined) // => true
isUndefined(null)      // => false
isUndefined(0)         // => false
```
```

---

### `isValidDate`

Checks if a value is a valid Date instance (not `Invalid Date`).

Unlike isDate, this also verifies that the internal timestamp is not `NaN`.

```typescript
import { isValidDate } from '@helpers4/type';

isValidDate(value: unknown): value is Date
```

**Parameters:**

- `value: unknown` — The value to check

**Returns:** `value is Date` — True if value is a Date instance with a valid time value

**Examples:**

*isValidDate*

```typescript
```ts
isValidDate(new Date())          // => true
isValidDate(new Date('invalid')) // => false
isValidDate('2023-01-01')       // => false (not a Date instance)
```
```

---

### `isValidRegex`

Checks if a string is a valid regex pattern.

```typescript
import { isValidRegex } from '@helpers4/type';

isValidRegex(value: string): boolean
```

**Parameters:**

- `value: string` — The string to check

**Returns:** `boolean` — True if the string is a valid regex pattern

**Examples:**

*isValidRegex*

```typescript
```ts
isValidRegex('[a-z]+') // => true
isValidRegex('.*')     // => true
isValidRegex('[')      // => false
```
```

---
