
Research
/Security News
Popular Go Decimal Library Targeted by Long-Running Typosquat with DNS Backdoor
A long-running Go typosquat impersonated the popular shopspring/decimal library and used DNS TXT records to execute commands.
@xylabs/object-model
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
Using npm:
npm install {{name}}
Using yarn:
yarn add {{name}}
Using pnpm:
pnpm add {{name}}
Using bun:
bun add {{name}}
See the LICENSE file for license rights and limitations (LGPL-3.0-only).
### .temp-typedoc
### interfaces
### <a id="AsTypeFunction"></a>AsTypeFunction
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
T extends AnyNonPromise = AnyNonPromise
AsTypeFunction<TType>(value): TType | undefined;
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
TType extends AnyNonPromise
AnyNonPromise
TType | undefined
AsTypeFunction<TType>(value, config): TType;
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
TType extends AnyNonPromise
AnyNonPromise
TType
AsTypeFunction<TType>(value, config): TType | undefined;
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
TType extends AnyNonPromise
AnyNonPromise
| TypeCheckConfig
| TypeCheckOptionalConfig
TType | undefined
AsTypeFunction<TType>(value, assert): TType | undefined;
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
TType extends AnyNonPromise
AnyNonPromise
StringOrAlertFunction<TType>
TType | undefined
AsTypeFunction<TType>(
value,
assert,
config): TType;
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
TType extends AnyNonPromise
AnyNonPromise
StringOrAlertFunction<TType>
TType
AsTypeFunction<TType>(
value,
assert,
config): TType | undefined;
A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.
TType extends AnyNonPromise
AnyNonPromise
StringOrAlertFunction<TType>
| TypeCheckConfig
| TypeCheckOptionalConfig
TType | undefined
### <a id="TypeCheck"></a>TypeCheck
A type guard function that checks whether a value conforms to type T, with optional configuration.
T extends TypedValue
TypeCheck(obj): obj is T;
A type guard function that checks whether a value conforms to type T, with optional configuration.
AnyNonPromise
obj is T
TypeCheck(obj, config): obj is T;
A type guard function that checks whether a value conforms to type T, with optional configuration.
AnyNonPromise
obj is T
TypeCheck(obj, config): obj is T;
A type guard function that checks whether a value conforms to type T, with optional configuration.
AnyNonPromise
number | TypeCheckConfig | undefined
obj is T
### <a id="TypeCheckConfig"></a>TypeCheckConfig
Configuration options for type check functions, with optional logging.
optional log?: boolean | Logger;
### <a id="TypeCheckOptionalConfig"></a>TypeCheckOptionalConfig
Type check configuration that marks the value as optional, returning undefined on failure.
optional log?: boolean | Logger;
required: false;
### <a id="TypeCheckRequiredConfig"></a>TypeCheckRequiredConfig
Type check configuration that marks the value as required, causing assertions on failure.
optional log?: boolean | Logger;
required: true;
### type-aliases
### <a id="AnyObject"></a>AnyObject
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
### <a id="AsOptionalTypeFunction"></a>AsOptionalTypeFunction
type AsOptionalTypeFunction<T> = <TType>(value) => TType | undefined;
A simplified type-narrowing function that returns T or undefined, without assertion support.
T extends AnyNonPromise = AnyNonPromise
TType extends T
AnyNonPromise
TType | undefined
### <a id="Compare"></a>Compare
type Compare<T> = (a, b) => number;
A comparator function that returns a negative number if a < b, zero if a == b, and a positive number if a > b.
T
T
T
number
### <a id="EmptyObject"></a>EmptyObject
type EmptyObject<T> = Exclude<{ [K in keyof T]?: never }, unknown[] | ((...args) => 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
T extends object = object
### <a id="StringOrAlertFunction"></a>StringOrAlertFunction
type StringOrAlertFunction<T> = string | AssertExMessageFunc<T>;
A string message or function that produces an assertion error message for a failed type check.
T extends AnyNonPromise
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/object-model receives a total of 18,968 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.

Research
/Security News
A long-running Go typosquat impersonated the popular shopspring/decimal library and used DNS TXT records to execute commands.

Research
Active npm supply chain attack compromises @antv packages in a fast-moving malicious publish wave tied to Mini Shai-Hulud.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.