npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xylabs/object-model

v5.1.2

Published

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

Readme

@xylabs/object-model

npm license

Base functionality used throughout XY Labs TypeScript/JavaScript libraries

Install

Using npm:

npm install {{name}}

Using yarn:

yarn add {{name}}

Using pnpm:

pnpm add {{name}}

Using bun:

bun add {{name}}

License

See the LICENSE file for license rights and limitations (LGPL-3.0-only).

Reference

packages

object-model

### .temp-typedoc

  ### interfaces

    ### <a id="AsTypeFunction"></a>AsTypeFunction

@xylabs/object-model


A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.

Type Parameters

T

T extends AnyNonPromise = AnyNonPromise

Call Signature

AsTypeFunction<TType>(value): TType | undefined;

A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.

Type Parameters

TType

TType extends AnyNonPromise

Parameters

value

AnyNonPromise

Returns

TType | undefined

Call Signature

AsTypeFunction<TType>(value, config): TType;

A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.

Type Parameters

TType

TType extends AnyNonPromise

Parameters

value

AnyNonPromise

config

TypeCheckRequiredConfig

Returns

TType

Call Signature

AsTypeFunction<TType>(value, config): TType | undefined;

A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.

Type Parameters

TType

TType extends AnyNonPromise

Parameters

value

AnyNonPromise

config

| TypeCheckConfig | TypeCheckOptionalConfig

Returns

TType | undefined

Call Signature

AsTypeFunction<TType>(value, assert): TType | undefined;

A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.

Type Parameters

TType

TType extends AnyNonPromise

Parameters

value

AnyNonPromise

assert

StringOrAlertFunction<TType>

Returns

TType | undefined

Call Signature

AsTypeFunction<TType>(
   value, 
   assert, 
   config): TType;

A type-narrowing function that attempts to cast a value to T, with optional assertion and configuration overloads.

Type Parameters

TType

TType extends AnyNonPromise

Parameters

value

AnyNonPromise

assert

StringOrAlertFunction<TType>

config

TypeCheckRequiredConfig

Returns

TType

Call Signature

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.

Type Parameters

TType

TType extends AnyNonPromise

Parameters

value

AnyNonPromise

assert

StringOrAlertFunction<TType>

config

| TypeCheckConfig | TypeCheckOptionalConfig

Returns

TType | undefined

    ### <a id="TypeCheck"></a>TypeCheck

@xylabs/object-model


A type guard function that checks whether a value conforms to type T, with optional configuration.

Type Parameters

T

T extends TypedValue

Call Signature

TypeCheck(obj): obj is T;

A type guard function that checks whether a value conforms to type T, with optional configuration.

Parameters

obj

AnyNonPromise

Returns

obj is T

Call Signature

TypeCheck(obj, config): obj is T;

A type guard function that checks whether a value conforms to type T, with optional configuration.

Parameters

obj

AnyNonPromise

config

TypeCheckConfig

Returns

obj is T

Call Signature

TypeCheck(obj, config): obj is T;

A type guard function that checks whether a value conforms to type T, with optional configuration.

Parameters

obj

AnyNonPromise

config

number | TypeCheckConfig | undefined

Returns

obj is T

    ### <a id="TypeCheckConfig"></a>TypeCheckConfig

@xylabs/object-model


Configuration options for type check functions, with optional logging.

Extended by

Properties

log?

optional log?: boolean | Logger;
    ### <a id="TypeCheckOptionalConfig"></a>TypeCheckOptionalConfig

@xylabs/object-model


Type check configuration that marks the value as optional, returning undefined on failure.

Extends

Properties

log?

optional log?: boolean | Logger;

Inherited from

TypeCheckConfig.log


required

required: false;
    ### <a id="TypeCheckRequiredConfig"></a>TypeCheckRequiredConfig

@xylabs/object-model


Type check configuration that marks the value as required, causing assertions on failure.

Extends

Properties

log?

optional log?: boolean | Logger;

Inherited from

TypeCheckConfig.log


required

required: true;
  ### type-aliases

    ### <a id="AnyObject"></a>AnyObject

@xylabs/object-model


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

@xylabs/object-model


type AsOptionalTypeFunction<T> = <TType>(value) => TType | undefined;

A simplified type-narrowing function that returns T or undefined, without assertion support.

Type Parameters

T

T extends AnyNonPromise = AnyNonPromise

Type Parameters

TType

TType extends T

Parameters

value

AnyNonPromise

Returns

TType | undefined

    ### <a id="Compare"></a>Compare

@xylabs/object-model


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.

Type Parameters

T

T

Parameters

a

T

b

T

Returns

number

    ### <a id="EmptyObject"></a>EmptyObject

@xylabs/object-model


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

Type Parameters

T

T extends object = object

    ### <a id="StringOrAlertFunction"></a>StringOrAlertFunction

@xylabs/object-model


type StringOrAlertFunction<T> = string | AssertExMessageFunc<T>;

A string message or function that produces an assertion error message for a failed type check.

Type Parameters

T

T extends AnyNonPromise