Socket
Socket
Sign inDemoInstall

@dldc/stack

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dldc/stack - npm Package Compare versions

Comparing version 4.1.7 to 5.0.0

48

dist/mod.d.ts

@@ -10,3 +10,3 @@ declare const INTERNAL: unique symbol;

type TStringify<T> = (value: T) => string;
interface IKeyConsumer<T, HasDefault extends boolean = boolean> {
interface TKeyConsumer<T, HasDefault extends boolean = boolean> {
readonly [INTERNAL]: true;

@@ -18,16 +18,16 @@ readonly stringify: TStringify<T>;

}
interface IKeyProvider<T, HasDefault extends boolean = boolean> {
interface TKeyProvider<T, HasDefault extends boolean = boolean> {
readonly [INTERNAL]: true;
readonly name: string;
readonly consumer: IKeyConsumer<T, HasDefault>;
readonly consumer: TKeyConsumer<T, HasDefault>;
readonly value: T;
}
type TArgsBase = readonly any[];
type TKeyProviderFn<T, HasDefault extends boolean, Args extends TArgsBase> = (...args: Args) => IKeyProvider<T, HasDefault>;
interface IKeyBase<T, HasDefault extends boolean, Args extends TArgsBase = [T]> {
Consumer: IKeyConsumer<T, HasDefault>;
type TKeyProviderFn<T, HasDefault extends boolean, Args extends TArgsBase> = (...args: Args) => TKeyProvider<T, HasDefault>;
interface TKeyBase<T, HasDefault extends boolean, Args extends TArgsBase = [T]> {
Consumer: TKeyConsumer<T, HasDefault>;
Provider: TKeyProviderFn<T, HasDefault, Args>;
}
type TKey<T, HasDefault extends boolean = false> = IKeyBase<T, HasDefault, [value: T]>;
type TVoidKey<HasDefault extends boolean = false> = IKeyBase<undefined, HasDefault, []>;
type TKey<T, HasDefault extends boolean = false> = TKeyBase<T, HasDefault, [value: T]>;
type TVoidKey<HasDefault extends boolean = false> = TKeyBase<undefined, HasDefault, []>;
declare const Key: {

@@ -40,7 +40,7 @@ create: <T>(name: string, stringify?: TStringify<T>) => TKey<T, false>;

declare class MissingContextError extends Error {
keyConsumer: IKeyConsumer<any>;
constructor(keyConsumer: IKeyConsumer<any>);
keyConsumer: TKeyConsumer<any>;
constructor(keyConsumer: TKeyConsumer<any>);
}
type TStackCoreTuple = [parent: StackCore, provider: IKeyProvider<any>];
type TStackCoreTuple = [parent: StackCore, provider: TKeyProvider<any>];
type TStackCoreValue = StackCore | null;

@@ -51,3 +51,3 @@ declare class StackCore {

private readonly [PROVIDER];
protected constructor(provider: IKeyProvider<any>, parent?: TStackCoreValue);
protected constructor(provider: TKeyProvider<any>, parent?: TStackCoreValue);
toString(): string;

@@ -61,8 +61,8 @@ /**

*/
static findFirstMatch(stack: TStackCoreValue, consumer: IKeyConsumer<any, any>): {
static findFirstMatch(stack: TStackCoreValue, consumer: TKeyConsumer<any, any>): {
found: boolean;
value: any;
};
static has(stack: TStackCoreValue, consumer: IKeyConsumer<any, any>): boolean;
static get<T, HasDefault extends boolean>(stack: TStackCoreValue, consumer: IKeyConsumer<T, HasDefault>): HasDefault extends true ? T : T | null;
static has(stack: TStackCoreValue, consumer: TKeyConsumer<any, any>): boolean;
static get<T, HasDefault extends boolean>(stack: TStackCoreValue, consumer: TKeyConsumer<T, HasDefault>): HasDefault extends true ? T : T | null;
/**

@@ -72,4 +72,4 @@ * Return a string that represents the content of the stact or null if empty.

static inspect(stack: TStackCoreValue): string | null;
static getAll<T>(stack: TStackCoreValue, consumer: IKeyConsumer<T>): IterableIterator<T>;
static getOrFail<T>(stack: TStackCoreValue, consumer: IKeyConsumer<T>): T;
static getAll<T>(stack: TStackCoreValue, consumer: TKeyConsumer<T>): IterableIterator<T>;
static getOrFail<T>(stack: TStackCoreValue, consumer: TKeyConsumer<T>): T;
static extract(stack: TStackCoreValue): IterableIterator<TStackCoreTuple>;

@@ -79,3 +79,3 @@ /**

*/
static with(stack: TStackCoreValue, ...keys: readonly IKeyProvider<any>[]): TStackCoreValue;
static with(stack: TStackCoreValue, ...keys: readonly TKeyProvider<any>[]): TStackCoreValue;
/**

@@ -101,6 +101,6 @@ * Merge two StackCore instances into one.

constructor(core?: TStackCoreValue);
has(consumer: IKeyConsumer<any, any>): boolean;
get<T, HasDefault extends boolean>(consumer: IKeyConsumer<T, HasDefault>): HasDefault extends true ? T : T | null;
getAll<T>(consumer: IKeyConsumer<T>): IterableIterator<T>;
getOrFail<T>(consumer: IKeyConsumer<T>): T;
has(consumer: TKeyConsumer<any, any>): boolean;
get<T, HasDefault extends boolean>(consumer: TKeyConsumer<T, HasDefault>): HasDefault extends true ? T : T | null;
getAll<T>(consumer: TKeyConsumer<T>): IterableIterator<T>;
getOrFail<T>(consumer: TKeyConsumer<T>): T;
inspect(): string;

@@ -113,3 +113,3 @@ toString(): string;

protected instantiate(stackCore: TStackCoreValue): this;
with(...keys: Array<IKeyProvider<any>>): this;
with(...keys: Array<TKeyProvider<any>>): this;
merge(other: Stack): this;

@@ -119,2 +119,2 @@ dedupe(): this;

export { type IKeyBase, type IKeyConsumer, type IKeyProvider, Key, MissingContextError, Stack, StackCore, type TArgsBase, type TKey, type TKeyProviderFn, type TStackCoreTuple, type TStackCoreValue, type TStringify, type TVoidKey };
export { Key, MissingContextError, Stack, StackCore, type TArgsBase, type TKey, type TKeyBase, type TKeyConsumer, type TKeyProvider, type TKeyProviderFn, type TStackCoreTuple, type TStackCoreValue, type TStringify, type TVoidKey };
{
"name": "@dldc/stack",
"version": "4.1.7",
"version": "5.0.0",
"description": "A library to create type-safe opaque stacks",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc