
Security News
Node.js Moves to Annual Major Releases Starting with Node 27
The project is retiring its odd/even release model in favor of a simpler annual cadence where every major version becomes LTS.
@xylabs/object-model
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
@xylabs/object-model
| Interface | Description |
|---|---|
| TypeCheckConfig | Configuration options for type check functions, with optional logging. |
| TypeCheckRequiredConfig | Type check configuration that marks the value as required, causing assertions on failure. |
| TypeCheckOptionalConfig | Type check configuration that marks the value as optional, returning undefined on failure. |
| Type Alias | Description |
|---|---|
| AnyObject | Any object, which means that it does not enforce the set of fields that it has. Extending from AnyObject will result in a type that includes the universal set of field names |
| AsTypeFunction | A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads. |
| AsOptionalTypeFunction | A simplified type-narrowing function that returns T or undefined, without assertion support. |
| Compare | A comparator function that returns a negative number if a < b, zero if a == b, and a positive number if a > b. |
| EmptyObject | An empty object, which means that it does enforce the set of field names, defaulting to an empty set until extended from, which then adds only those additional fields |
| StringOrAlertFunction | A string message or function that produces an assertion error message for a failed type check. |
| TypeCheck | A type guard function that checks whether a value conforms to type T, with optional configuration. |
Configuration options for type check functions, with optional logging.
| Property | Type |
|---|---|
log? | boolean | Logger |
Type check configuration that marks the value as optional, returning undefined on failure.
| Property | Type | Inherited from |
|---|---|---|
log? | boolean | Logger | TypeCheckConfig.log |
required | false | - |
Type check configuration that marks the value as required, causing assertions on failure.
| Property | Type | Inherited from |
|---|---|---|
log? | boolean | Logger | TypeCheckConfig.log |
required | true | - |
type AnyObject = EmptyObject & Partial<Record<TypedKey, unknown>>;
Any object, which means that it does not enforce the set of fields that it has. Extending from AnyObject will result in a type that includes the universal set of field names
type AsOptionalTypeFunction<T> = <TType>(value: AnyNonPromise) => TType | undefined;
A simplified type-narrowing function that returns T or undefined, without assertion support.
| Type Parameter | Default type |
|---|---|
T extends AnyNonPromise | AnyNonPromise |
| Type Parameter |
|---|
TType extends AnyNonPromise |
| Parameter | Type |
|---|---|
value | AnyNonPromise |
TType | undefined
type AsTypeFunction<T> = {
<TType> (value: AnyNonPromise): TType | undefined;
<TType> (value: AnyNonPromise, config: TypeCheckRequiredConfig): TType;
<TType> (value: AnyNonPromise, config:
| TypeCheckConfig
| TypeCheckOptionalConfig): TType | undefined;
<TType> (value: AnyNonPromise, assert: StringOrAlertFunction<TType>): TType | undefined;
<TType> (value: AnyNonPromise, assert: StringOrAlertFunction<TType>, config: TypeCheckRequiredConfig): TType;
<TType> (value: AnyNonPromise, assert: StringOrAlertFunction<TType>, config:
| TypeCheckConfig
| TypeCheckOptionalConfig): TType | undefined;
};
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
| Type Parameter | Default type |
|---|---|
T extends AnyNonPromise | AnyNonPromise |
<TType>(value: AnyNonPromise): TType | undefined;
| Type Parameter |
|---|
TType extends AnyNonPromise |
| Parameter | Type |
|---|---|
value | AnyNonPromise |
TType | undefined
<TType>(value: AnyNonPromise, config: TypeCheckRequiredConfig): TType;
| Type Parameter |
|---|
TType extends AnyNonPromise |
| Parameter | Type |
|---|---|
value | AnyNonPromise |
config | TypeCheckRequiredConfig |
TType
<TType>(value: AnyNonPromise, config:
| TypeCheckConfig
| TypeCheckOptionalConfig): TType | undefined;
| Type Parameter |
|---|
TType extends AnyNonPromise |
| Parameter | Type |
|---|---|
value | AnyNonPromise |
config | | TypeCheckConfig | TypeCheckOptionalConfig |
TType | undefined
<TType>(value: AnyNonPromise, assert: StringOrAlertFunction<TType>): TType | undefined;
| Type Parameter |
|---|
TType extends AnyNonPromise |
| Parameter | Type |
|---|---|
value | AnyNonPromise |
assert | StringOrAlertFunction<TType> |
TType | undefined
<TType>(
value: AnyNonPromise,
assert: StringOrAlertFunction<TType>,
config: TypeCheckRequiredConfig): TType;
| Type Parameter |
|---|
TType extends AnyNonPromise |
| Parameter | Type |
|---|---|
value | AnyNonPromise |
assert | StringOrAlertFunction<TType> |
config | TypeCheckRequiredConfig |
TType
<TType>(
value: AnyNonPromise,
assert: StringOrAlertFunction<TType>,
config:
| TypeCheckConfig
| TypeCheckOptionalConfig): TType | undefined;
| Type Parameter |
|---|
TType extends AnyNonPromise |
| Parameter | Type |
|---|---|
value | AnyNonPromise |
assert | StringOrAlertFunction<TType> |
config | | TypeCheckConfig | TypeCheckOptionalConfig |
TType | undefined
type Compare<T> = (a: T, b: T) => number;
A comparator function that returns a negative number if a < b, zero if a == b, and a positive number if a > b.
| Type Parameter |
|---|
T |
| Parameter | Type |
|---|---|
a | T |
b | T |
number
type EmptyObject<T> = Exclude<{ [K in keyof T]?: never }, unknown[] | (...args: unknown[]) => unknown | null>;
An empty object, which means that it does enforce the set of field names, defaulting to an empty set until extended from, which then adds only those additional fields
| Type Parameter | Default type |
|---|---|
T extends object | object |
type StringOrAlertFunction<T> = string | AssertExMessageFunc<T>;
A string message or function that produces an assertion error message for a failed type check.
| Type Parameter |
|---|
T extends AnyNonPromise |
type TypeCheck<T> = {
(obj: AnyNonPromise): obj is T;
(obj: AnyNonPromise, config: TypeCheckConfig): obj is T;
(obj: AnyNonPromise, config:
| number
| TypeCheckConfig
| undefined): obj is T;
};
A type guard function that checks whether a value conforms to type T, with optional configuration.
| Type Parameter |
|---|
T extends TypedValue |
(obj: AnyNonPromise): obj is T;
| Parameter | Type |
|---|---|
obj | AnyNonPromise |
obj is T
(obj: AnyNonPromise, config: TypeCheckConfig): obj is T;
| Parameter | Type |
|---|---|
obj | AnyNonPromise |
config | TypeCheckConfig |
obj is T
(obj: AnyNonPromise, config:
| number
| TypeCheckConfig
| undefined): obj is T;
| Parameter | Type |
|---|---|
obj | AnyNonPromise |
config | | number | TypeCheckConfig | undefined |
obj is T
Part of sdk-js
See the LICENSE file for license details
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/object-model receives a total of 11,766 weekly downloads. As such, @xylabs/object-model popularity was classified as popular.
We found that @xylabs/object-model demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The project is retiring its odd/even release model in favor of a simpler annual cadence where every major version becomes LTS.

Research
/Security News
Published late February to early March 2026, these crates impersonate timeapi.io and POST .env secrets to a threat actor-controlled lookalike domain.

Security News
A recent burst of security disclosures in the OpenClaw project is drawing attention to how vulnerability information flows across advisory and CVE systems.