Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@augment-vir/common

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@augment-vir/common - npm Package Compare versions

Comparing version 5.0.1 to 6.0.0

dist/cjs/augments/ansi.d.ts.map

1

dist/cjs/augments/ansi.d.ts
export declare const ansiRegex: RegExp;
//# sourceMappingURL=ansi.d.ts.map

5

dist/cjs/augments/array.d.ts

@@ -5,6 +5,6 @@ import { AtLeastTuple } from './tuple';

export declare function flatten2dArray<T>(array2d: ReadonlyArray<ReadonlyArray<T>>): T[];
export declare type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
export type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
export declare function trimArrayStrings(input: ReadonlyArray<string>): string[];
export declare function typedArrayIncludes<T>(array: ReadonlyArray<T>, input: unknown): input is T;
declare type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
/** Preserves tuple types. */

@@ -15,1 +15,2 @@ export declare function typedMap<InputArrayGeneric extends ReadonlyArray<any>, OutputType>(arrayToMap: InputArrayGeneric, mapCallback: MapCallbackType<InputArrayGeneric, OutputType>): {

export {};
//# sourceMappingURL=array.d.ts.map

@@ -15,1 +15,2 @@ /**

}): Promise<OriginalGeneric[]>;
//# sourceMappingURL=async.d.ts.map

@@ -33,1 +33,2 @@ export declare function addCommasToNumber(input: number): string;

}): string;
//# sourceMappingURL=common-number.d.ts.map

@@ -19,3 +19,3 @@ import { AtLeastTuple } from './tuple';

export declare function splitIncludeSplit(original: string, splitterInput: string | RegExp, caseSensitive: boolean): readonly string[];
export declare type CasingOptions = {
export type CasingOptions = {
capitalizeFirstLetter: boolean;

@@ -46,1 +46,2 @@ };

export declare function typedSplit(input: string, splitString: string): AtLeastTuple<string, 1>;
//# sourceMappingURL=common-string.d.ts.map

@@ -27,1 +27,2 @@ export declare const englishFullMonthNames: readonly ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];

export declare function createDateFromUtcIsoFormat(isoFormatString: string): Date;
//# sourceMappingURL=date.d.ts.map
export declare function isBrowser(): boolean;
//# sourceMappingURL=environment.d.ts.map

@@ -9,1 +9,2 @@ import { AtLeastTuple } from './tuple';

export declare function ensureError(input: unknown): Error;
//# sourceMappingURL=error.d.ts.map

@@ -0,1 +1,3 @@

export type AnyFunction = (...args: any[]) => any;
export declare function isTruthy<T>(input: T): input is NonNullable<T>;
//# sourceMappingURL=function.d.ts.map

@@ -10,5 +10,5 @@ import { AtLeastOneEntryArray } from './array';

export declare function getObjectTypedValues<ObjectGeneric extends unknown>(input: ObjectGeneric): ObjectGeneric[keyof ObjectGeneric][];
declare type ExtractValue<KeyGeneric extends PropertyKey, ParentGeneric> = KeyGeneric extends keyof ParentGeneric ? RequiredBy<ParentGeneric, KeyGeneric>[KeyGeneric] : KeyGeneric extends keyof Extract<ParentGeneric, Record<KeyGeneric, any>> ? RequiredBy<Extract<ParentGeneric, Record<KeyGeneric, any>>, KeyGeneric>[KeyGeneric] : never;
declare type CombinedParentValue<KeyGeneric extends PropertyKey, ParentGeneric> = ExtractValue<KeyGeneric, ParentGeneric> extends never ? unknown : ExtractValue<KeyGeneric, ParentGeneric>;
declare type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentGeneric & Record<KeyGeneric, CombinedParentValue<KeyGeneric, ParentGeneric>>;
type ExtractValue<KeyGeneric extends PropertyKey, ParentGeneric> = KeyGeneric extends keyof ParentGeneric ? RequiredBy<ParentGeneric, KeyGeneric>[KeyGeneric] : KeyGeneric extends keyof Extract<ParentGeneric, Record<KeyGeneric, any>> ? RequiredBy<Extract<ParentGeneric, Record<KeyGeneric, any>>, KeyGeneric>[KeyGeneric] : never;
type CombinedParentValue<KeyGeneric extends PropertyKey, ParentGeneric> = ExtractValue<KeyGeneric, ParentGeneric> extends never ? unknown : ExtractValue<KeyGeneric, ParentGeneric>;
type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentGeneric & Record<KeyGeneric, CombinedParentValue<KeyGeneric, ParentGeneric>>;
export declare function typedHasProperty<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKey: KeyGeneric): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;

@@ -19,6 +19,6 @@ export declare function typedHasProperties<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKeys: ReadonlyArray<KeyGeneric>): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;

export declare function areJsonEqual(a: object, b: object): boolean;
export declare type InnerMappedValues<EntireInputGeneric extends object, MappedValueGeneric> = {
export type InnerMappedValues<EntireInputGeneric extends object, MappedValueGeneric> = {
[MappedProp in keyof EntireInputGeneric]: MappedValueGeneric;
};
export declare type MappedValues<EntireInputGeneric extends object, MappedValueGeneric> = MappedValueGeneric extends PromiseLike<unknown> ? Promise<InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>> : InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>;
export type MappedValues<EntireInputGeneric extends object, MappedValueGeneric> = MappedValueGeneric extends PromiseLike<unknown> ? Promise<InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>> : InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>;
/**

@@ -32,3 +32,3 @@ * Creates a new object with the same properties as the input object, but with values set to the

export declare function copyThroughJson<T>(input: T): T;
export declare type ObjectValueType<T extends object> = T[keyof T];
export type ObjectValueType<T extends object> = T[keyof T];
/**

@@ -48,3 +48,3 @@ * Checks that the first input, testThisOne, matches the object shape of the second input,

export declare function matchesObjectShape<MatchThisGeneric extends object>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, shouldLogWhy?: boolean): testThisOne is MatchThisGeneric;
export declare type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
export type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
[Prop in keyof BaseObject]: BaseObject[Prop] extends ReadonlyArray<any> ? AtLeastOneEntryArray<BaseObject[Prop]> : BaseObject[Prop] extends object ? ObjectWithAtLeastSingleEntryArrays<BaseObject[Prop]> : BaseObject[Prop];

@@ -68,1 +68,2 @@ };

export {};
//# sourceMappingURL=object.d.ts.map

@@ -11,3 +11,3 @@ export declare function wait(delayMs: number): Promise<void>;

/** A promise which can be resolved or rejected by external code. */
export declare type DeferredPromiseWrapper<T> = {
export type DeferredPromiseWrapper<T> = {
promise: Promise<T>;

@@ -18,3 +18,3 @@ resolve: (value: T | PromiseLike<T>) => void;

export declare function createDeferredPromiseWrapper<T = void>(): DeferredPromiseWrapper<T>;
export declare type WaitForConditionInputs = {
export type WaitForConditionInputs = {
conditionCallback: () => boolean | Promise<boolean>;

@@ -26,1 +26,2 @@ timeoutMs?: number;

export declare function waitForCondition({ conditionCallback, timeoutMs, intervalMs, timeoutMessage, }: WaitForConditionInputs): Promise<void>;
//# sourceMappingURL=promise.d.ts.map
export declare function deDupeRegExFlags(flags: string): string;
export declare function addRegExpFlags(originalRegExp: RegExp, flags: string): RegExp;
export declare function safeMatch(input: string, regExp: RegExp): string[];
//# sourceMappingURL=regexp.d.ts.map

@@ -1,4 +0,4 @@

export declare type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never;
declare type _TupleOf<ArrayElementGeneric, LengthGeneric extends number, FullArrayGeneric extends unknown[]> = FullArrayGeneric['length'] extends LengthGeneric ? FullArrayGeneric : _TupleOf<ArrayElementGeneric, LengthGeneric, [ArrayElementGeneric, ...FullArrayGeneric]>;
export declare type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = readonly [
export type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never;
type _TupleOf<ArrayElementGeneric, LengthGeneric extends number, FullArrayGeneric extends unknown[]> = FullArrayGeneric['length'] extends LengthGeneric ? FullArrayGeneric : _TupleOf<ArrayElementGeneric, LengthGeneric, [ArrayElementGeneric, ...FullArrayGeneric]>;
export type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = readonly [
...Tuple<ArrayElementGeneric, LengthGeneric>,

@@ -9,1 +9,2 @@ ...ArrayElementGeneric[]

export {};
//# sourceMappingURL=tuple.d.ts.map

@@ -0,9 +1,10 @@

import { AnyFunction } from '@augment-vir/common';
declare function getTypeOf(x: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
export declare type TypeOf = ReturnType<typeof getTypeOf>;
export declare type TypeOfWithArray = TypeOf | 'array';
export declare type TypeOfMapping = {
export type TypeOf = ReturnType<typeof getTypeOf>;
export type TypeOfWithArray = TypeOf | 'array';
export type TypeOfMapping = {
array: any[];
bigint: bigint;
boolean: boolean;
function: (...args: any[]) => any;
function: AnyFunction;
number: number;

@@ -18,1 +19,2 @@ object: object;

export {};
//# sourceMappingURL=type-of.d.ts.map
/** Makes all properties in an object writable. This is the opposite of Readonly<> */
export declare type Writeable<T> = {
export type Writeable<T> = {
-readonly [P in keyof T]: T[P];
};
/** Makes all property values in an object also readonly. Can cause issues on primitive. */
export declare type DeepWriteable<T> = {
export type DeepWriteable<T> = {
-readonly [P in keyof T]: DeepWriteable<T[P]>;
};
/** Replace properties in T with properties in U. */
export declare type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
/** Extract the element type out of an array type. */
export declare type ArrayElement<ArrayType extends ReadonlyArray<any>> = ArrayType[number];
export type ArrayElement<ArrayType extends ReadonlyArray<any>> = ArrayType[number];
/**

@@ -17,7 +17,7 @@ * Same as the Required<> built-in type helper but this requires that each property be present and

*/
export declare type RequiredAndNotNull<T> = {
export type RequiredAndNotNull<T> = {
[P in keyof T]-?: NonNullable<T[P]>;
};
/** Require only a subset of object properties. */
export declare type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
export type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
/**

@@ -27,8 +27,8 @@ * Require only a subset of object properties and require that they be not null. This is

*/
export declare type RequiredAndNotNullBy<T, K extends keyof T> = Omit<T, K> & Required<{
export type RequiredAndNotNullBy<T, K extends keyof T> = Omit<T, K> & Required<{
[PropertyName in K]: NonNullable<T[PropertyName]>;
}>;
/** If type T = type U, then type Y. Else type N. */
export declare type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? Y : N;
export declare type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
export type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? Y : N;
export type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
/**

@@ -48,3 +48,3 @@ * This function returns another function that simply returns whatever input it's given. However, it

*/
export declare type NoInfer<T> = [T][T extends any ? 0 : never];
export type NoInfer<T> = [T][T extends any ? 0 : never];
/**

@@ -58,1 +58,2 @@ * This is a type helper that ensures the given input matches the given generic type. The generic is

export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>;
//# sourceMappingURL=type.d.ts.map

@@ -16,1 +16,2 @@ export * from './augments/ansi';

export * from './augments/type-of';
//# sourceMappingURL=index.d.ts.map
export declare const ansiRegex: RegExp;
//# sourceMappingURL=ansi.d.ts.map

@@ -5,6 +5,6 @@ import { AtLeastTuple } from './tuple';

export declare function flatten2dArray<T>(array2d: ReadonlyArray<ReadonlyArray<T>>): T[];
export declare type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
export type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
export declare function trimArrayStrings(input: ReadonlyArray<string>): string[];
export declare function typedArrayIncludes<T>(array: ReadonlyArray<T>, input: unknown): input is T;
declare type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
/** Preserves tuple types. */

@@ -15,1 +15,2 @@ export declare function typedMap<InputArrayGeneric extends ReadonlyArray<any>, OutputType>(arrayToMap: InputArrayGeneric, mapCallback: MapCallbackType<InputArrayGeneric, OutputType>): {

export {};
//# sourceMappingURL=array.d.ts.map

@@ -15,1 +15,2 @@ /**

}): Promise<OriginalGeneric[]>;
//# sourceMappingURL=async.d.ts.map

@@ -33,1 +33,2 @@ export declare function addCommasToNumber(input: number): string;

}): string;
//# sourceMappingURL=common-number.d.ts.map

@@ -19,3 +19,3 @@ import { AtLeastTuple } from './tuple';

export declare function splitIncludeSplit(original: string, splitterInput: string | RegExp, caseSensitive: boolean): readonly string[];
export declare type CasingOptions = {
export type CasingOptions = {
capitalizeFirstLetter: boolean;

@@ -46,1 +46,2 @@ };

export declare function typedSplit(input: string, splitString: string): AtLeastTuple<string, 1>;
//# sourceMappingURL=common-string.d.ts.map

@@ -27,1 +27,2 @@ export declare const englishFullMonthNames: readonly ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];

export declare function createDateFromUtcIsoFormat(isoFormatString: string): Date;
//# sourceMappingURL=date.d.ts.map
export declare function isBrowser(): boolean;
//# sourceMappingURL=environment.d.ts.map

@@ -9,1 +9,2 @@ import { AtLeastTuple } from './tuple';

export declare function ensureError(input: unknown): Error;
//# sourceMappingURL=error.d.ts.map

@@ -0,1 +1,3 @@

export type AnyFunction = (...args: any[]) => any;
export declare function isTruthy<T>(input: T): input is NonNullable<T>;
//# sourceMappingURL=function.d.ts.map

@@ -10,5 +10,5 @@ import { AtLeastOneEntryArray } from './array';

export declare function getObjectTypedValues<ObjectGeneric extends unknown>(input: ObjectGeneric): ObjectGeneric[keyof ObjectGeneric][];
declare type ExtractValue<KeyGeneric extends PropertyKey, ParentGeneric> = KeyGeneric extends keyof ParentGeneric ? RequiredBy<ParentGeneric, KeyGeneric>[KeyGeneric] : KeyGeneric extends keyof Extract<ParentGeneric, Record<KeyGeneric, any>> ? RequiredBy<Extract<ParentGeneric, Record<KeyGeneric, any>>, KeyGeneric>[KeyGeneric] : never;
declare type CombinedParentValue<KeyGeneric extends PropertyKey, ParentGeneric> = ExtractValue<KeyGeneric, ParentGeneric> extends never ? unknown : ExtractValue<KeyGeneric, ParentGeneric>;
declare type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentGeneric & Record<KeyGeneric, CombinedParentValue<KeyGeneric, ParentGeneric>>;
type ExtractValue<KeyGeneric extends PropertyKey, ParentGeneric> = KeyGeneric extends keyof ParentGeneric ? RequiredBy<ParentGeneric, KeyGeneric>[KeyGeneric] : KeyGeneric extends keyof Extract<ParentGeneric, Record<KeyGeneric, any>> ? RequiredBy<Extract<ParentGeneric, Record<KeyGeneric, any>>, KeyGeneric>[KeyGeneric] : never;
type CombinedParentValue<KeyGeneric extends PropertyKey, ParentGeneric> = ExtractValue<KeyGeneric, ParentGeneric> extends never ? unknown : ExtractValue<KeyGeneric, ParentGeneric>;
type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentGeneric & Record<KeyGeneric, CombinedParentValue<KeyGeneric, ParentGeneric>>;
export declare function typedHasProperty<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKey: KeyGeneric): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;

@@ -19,6 +19,6 @@ export declare function typedHasProperties<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKeys: ReadonlyArray<KeyGeneric>): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;

export declare function areJsonEqual(a: object, b: object): boolean;
export declare type InnerMappedValues<EntireInputGeneric extends object, MappedValueGeneric> = {
export type InnerMappedValues<EntireInputGeneric extends object, MappedValueGeneric> = {
[MappedProp in keyof EntireInputGeneric]: MappedValueGeneric;
};
export declare type MappedValues<EntireInputGeneric extends object, MappedValueGeneric> = MappedValueGeneric extends PromiseLike<unknown> ? Promise<InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>> : InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>;
export type MappedValues<EntireInputGeneric extends object, MappedValueGeneric> = MappedValueGeneric extends PromiseLike<unknown> ? Promise<InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>> : InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>;
/**

@@ -32,3 +32,3 @@ * Creates a new object with the same properties as the input object, but with values set to the

export declare function copyThroughJson<T>(input: T): T;
export declare type ObjectValueType<T extends object> = T[keyof T];
export type ObjectValueType<T extends object> = T[keyof T];
/**

@@ -48,3 +48,3 @@ * Checks that the first input, testThisOne, matches the object shape of the second input,

export declare function matchesObjectShape<MatchThisGeneric extends object>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, shouldLogWhy?: boolean): testThisOne is MatchThisGeneric;
export declare type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
export type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
[Prop in keyof BaseObject]: BaseObject[Prop] extends ReadonlyArray<any> ? AtLeastOneEntryArray<BaseObject[Prop]> : BaseObject[Prop] extends object ? ObjectWithAtLeastSingleEntryArrays<BaseObject[Prop]> : BaseObject[Prop];

@@ -68,1 +68,2 @@ };

export {};
//# sourceMappingURL=object.d.ts.map

@@ -11,3 +11,3 @@ export declare function wait(delayMs: number): Promise<void>;

/** A promise which can be resolved or rejected by external code. */
export declare type DeferredPromiseWrapper<T> = {
export type DeferredPromiseWrapper<T> = {
promise: Promise<T>;

@@ -18,3 +18,3 @@ resolve: (value: T | PromiseLike<T>) => void;

export declare function createDeferredPromiseWrapper<T = void>(): DeferredPromiseWrapper<T>;
export declare type WaitForConditionInputs = {
export type WaitForConditionInputs = {
conditionCallback: () => boolean | Promise<boolean>;

@@ -26,1 +26,2 @@ timeoutMs?: number;

export declare function waitForCondition({ conditionCallback, timeoutMs, intervalMs, timeoutMessage, }: WaitForConditionInputs): Promise<void>;
//# sourceMappingURL=promise.d.ts.map
export declare function deDupeRegExFlags(flags: string): string;
export declare function addRegExpFlags(originalRegExp: RegExp, flags: string): RegExp;
export declare function safeMatch(input: string, regExp: RegExp): string[];
//# sourceMappingURL=regexp.d.ts.map

@@ -1,4 +0,4 @@

export declare type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never;
declare type _TupleOf<ArrayElementGeneric, LengthGeneric extends number, FullArrayGeneric extends unknown[]> = FullArrayGeneric['length'] extends LengthGeneric ? FullArrayGeneric : _TupleOf<ArrayElementGeneric, LengthGeneric, [ArrayElementGeneric, ...FullArrayGeneric]>;
export declare type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = readonly [
export type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never;
type _TupleOf<ArrayElementGeneric, LengthGeneric extends number, FullArrayGeneric extends unknown[]> = FullArrayGeneric['length'] extends LengthGeneric ? FullArrayGeneric : _TupleOf<ArrayElementGeneric, LengthGeneric, [ArrayElementGeneric, ...FullArrayGeneric]>;
export type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = readonly [
...Tuple<ArrayElementGeneric, LengthGeneric>,

@@ -9,1 +9,2 @@ ...ArrayElementGeneric[]

export {};
//# sourceMappingURL=tuple.d.ts.map

@@ -0,9 +1,10 @@

import { AnyFunction } from '@augment-vir/common';
declare function getTypeOf(x: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
export declare type TypeOf = ReturnType<typeof getTypeOf>;
export declare type TypeOfWithArray = TypeOf | 'array';
export declare type TypeOfMapping = {
export type TypeOf = ReturnType<typeof getTypeOf>;
export type TypeOfWithArray = TypeOf | 'array';
export type TypeOfMapping = {
array: any[];
bigint: bigint;
boolean: boolean;
function: (...args: any[]) => any;
function: AnyFunction;
number: number;

@@ -18,1 +19,2 @@ object: object;

export {};
//# sourceMappingURL=type-of.d.ts.map
/** Makes all properties in an object writable. This is the opposite of Readonly<> */
export declare type Writeable<T> = {
export type Writeable<T> = {
-readonly [P in keyof T]: T[P];
};
/** Makes all property values in an object also readonly. Can cause issues on primitive. */
export declare type DeepWriteable<T> = {
export type DeepWriteable<T> = {
-readonly [P in keyof T]: DeepWriteable<T[P]>;
};
/** Replace properties in T with properties in U. */
export declare type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
/** Extract the element type out of an array type. */
export declare type ArrayElement<ArrayType extends ReadonlyArray<any>> = ArrayType[number];
export type ArrayElement<ArrayType extends ReadonlyArray<any>> = ArrayType[number];
/**

@@ -17,7 +17,7 @@ * Same as the Required<> built-in type helper but this requires that each property be present and

*/
export declare type RequiredAndNotNull<T> = {
export type RequiredAndNotNull<T> = {
[P in keyof T]-?: NonNullable<T[P]>;
};
/** Require only a subset of object properties. */
export declare type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
export type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
/**

@@ -27,8 +27,8 @@ * Require only a subset of object properties and require that they be not null. This is

*/
export declare type RequiredAndNotNullBy<T, K extends keyof T> = Omit<T, K> & Required<{
export type RequiredAndNotNullBy<T, K extends keyof T> = Omit<T, K> & Required<{
[PropertyName in K]: NonNullable<T[PropertyName]>;
}>;
/** If type T = type U, then type Y. Else type N. */
export declare type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? Y : N;
export declare type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
export type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? Y : N;
export type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
/**

@@ -48,3 +48,3 @@ * This function returns another function that simply returns whatever input it's given. However, it

*/
export declare type NoInfer<T> = [T][T extends any ? 0 : never];
export type NoInfer<T> = [T][T extends any ? 0 : never];
/**

@@ -58,1 +58,2 @@ * This is a type helper that ensures the given input matches the given generic type. The generic is

export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>;
//# sourceMappingURL=type.d.ts.map

@@ -16,1 +16,2 @@ export * from './augments/ansi';

export * from './augments/type-of';
//# sourceMappingURL=index.d.ts.map
export declare const ansiRegex: RegExp;
//# sourceMappingURL=ansi.d.ts.map

@@ -5,6 +5,6 @@ import { AtLeastTuple } from './tuple';

export declare function flatten2dArray<T>(array2d: ReadonlyArray<ReadonlyArray<T>>): T[];
export declare type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
export type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
export declare function trimArrayStrings(input: ReadonlyArray<string>): string[];
export declare function typedArrayIncludes<T>(array: ReadonlyArray<T>, input: unknown): input is T;
declare type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
/** Preserves tuple types. */

@@ -15,1 +15,2 @@ export declare function typedMap<InputArrayGeneric extends ReadonlyArray<any>, OutputType>(arrayToMap: InputArrayGeneric, mapCallback: MapCallbackType<InputArrayGeneric, OutputType>): {

export {};
//# sourceMappingURL=array.d.ts.map

@@ -15,1 +15,2 @@ /**

}): Promise<OriginalGeneric[]>;
//# sourceMappingURL=async.d.ts.map

@@ -33,1 +33,2 @@ export declare function addCommasToNumber(input: number): string;

}): string;
//# sourceMappingURL=common-number.d.ts.map

@@ -19,3 +19,3 @@ import { AtLeastTuple } from './tuple';

export declare function splitIncludeSplit(original: string, splitterInput: string | RegExp, caseSensitive: boolean): readonly string[];
export declare type CasingOptions = {
export type CasingOptions = {
capitalizeFirstLetter: boolean;

@@ -46,1 +46,2 @@ };

export declare function typedSplit(input: string, splitString: string): AtLeastTuple<string, 1>;
//# sourceMappingURL=common-string.d.ts.map

@@ -27,1 +27,2 @@ export declare const englishFullMonthNames: readonly ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];

export declare function createDateFromUtcIsoFormat(isoFormatString: string): Date;
//# sourceMappingURL=date.d.ts.map
export declare function isBrowser(): boolean;
//# sourceMappingURL=environment.d.ts.map

@@ -9,1 +9,2 @@ import { AtLeastTuple } from './tuple';

export declare function ensureError(input: unknown): Error;
//# sourceMappingURL=error.d.ts.map

@@ -0,1 +1,3 @@

export type AnyFunction = (...args: any[]) => any;
export declare function isTruthy<T>(input: T): input is NonNullable<T>;
//# sourceMappingURL=function.d.ts.map

@@ -10,5 +10,5 @@ import { AtLeastOneEntryArray } from './array';

export declare function getObjectTypedValues<ObjectGeneric extends unknown>(input: ObjectGeneric): ObjectGeneric[keyof ObjectGeneric][];
declare type ExtractValue<KeyGeneric extends PropertyKey, ParentGeneric> = KeyGeneric extends keyof ParentGeneric ? RequiredBy<ParentGeneric, KeyGeneric>[KeyGeneric] : KeyGeneric extends keyof Extract<ParentGeneric, Record<KeyGeneric, any>> ? RequiredBy<Extract<ParentGeneric, Record<KeyGeneric, any>>, KeyGeneric>[KeyGeneric] : never;
declare type CombinedParentValue<KeyGeneric extends PropertyKey, ParentGeneric> = ExtractValue<KeyGeneric, ParentGeneric> extends never ? unknown : ExtractValue<KeyGeneric, ParentGeneric>;
declare type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentGeneric & Record<KeyGeneric, CombinedParentValue<KeyGeneric, ParentGeneric>>;
type ExtractValue<KeyGeneric extends PropertyKey, ParentGeneric> = KeyGeneric extends keyof ParentGeneric ? RequiredBy<ParentGeneric, KeyGeneric>[KeyGeneric] : KeyGeneric extends keyof Extract<ParentGeneric, Record<KeyGeneric, any>> ? RequiredBy<Extract<ParentGeneric, Record<KeyGeneric, any>>, KeyGeneric>[KeyGeneric] : never;
type CombinedParentValue<KeyGeneric extends PropertyKey, ParentGeneric> = ExtractValue<KeyGeneric, ParentGeneric> extends never ? unknown : ExtractValue<KeyGeneric, ParentGeneric>;
type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentGeneric & Record<KeyGeneric, CombinedParentValue<KeyGeneric, ParentGeneric>>;
export declare function typedHasProperty<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKey: KeyGeneric): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;

@@ -19,6 +19,6 @@ export declare function typedHasProperties<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKeys: ReadonlyArray<KeyGeneric>): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;

export declare function areJsonEqual(a: object, b: object): boolean;
export declare type InnerMappedValues<EntireInputGeneric extends object, MappedValueGeneric> = {
export type InnerMappedValues<EntireInputGeneric extends object, MappedValueGeneric> = {
[MappedProp in keyof EntireInputGeneric]: MappedValueGeneric;
};
export declare type MappedValues<EntireInputGeneric extends object, MappedValueGeneric> = MappedValueGeneric extends PromiseLike<unknown> ? Promise<InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>> : InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>;
export type MappedValues<EntireInputGeneric extends object, MappedValueGeneric> = MappedValueGeneric extends PromiseLike<unknown> ? Promise<InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>> : InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>;
/**

@@ -32,3 +32,3 @@ * Creates a new object with the same properties as the input object, but with values set to the

export declare function copyThroughJson<T>(input: T): T;
export declare type ObjectValueType<T extends object> = T[keyof T];
export type ObjectValueType<T extends object> = T[keyof T];
/**

@@ -48,3 +48,3 @@ * Checks that the first input, testThisOne, matches the object shape of the second input,

export declare function matchesObjectShape<MatchThisGeneric extends object>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, shouldLogWhy?: boolean): testThisOne is MatchThisGeneric;
export declare type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
export type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
[Prop in keyof BaseObject]: BaseObject[Prop] extends ReadonlyArray<any> ? AtLeastOneEntryArray<BaseObject[Prop]> : BaseObject[Prop] extends object ? ObjectWithAtLeastSingleEntryArrays<BaseObject[Prop]> : BaseObject[Prop];

@@ -68,1 +68,2 @@ };

export {};
//# sourceMappingURL=object.d.ts.map

@@ -11,3 +11,3 @@ export declare function wait(delayMs: number): Promise<void>;

/** A promise which can be resolved or rejected by external code. */
export declare type DeferredPromiseWrapper<T> = {
export type DeferredPromiseWrapper<T> = {
promise: Promise<T>;

@@ -18,3 +18,3 @@ resolve: (value: T | PromiseLike<T>) => void;

export declare function createDeferredPromiseWrapper<T = void>(): DeferredPromiseWrapper<T>;
export declare type WaitForConditionInputs = {
export type WaitForConditionInputs = {
conditionCallback: () => boolean | Promise<boolean>;

@@ -26,1 +26,2 @@ timeoutMs?: number;

export declare function waitForCondition({ conditionCallback, timeoutMs, intervalMs, timeoutMessage, }: WaitForConditionInputs): Promise<void>;
//# sourceMappingURL=promise.d.ts.map
export declare function deDupeRegExFlags(flags: string): string;
export declare function addRegExpFlags(originalRegExp: RegExp, flags: string): RegExp;
export declare function safeMatch(input: string, regExp: RegExp): string[];
//# sourceMappingURL=regexp.d.ts.map

@@ -1,4 +0,4 @@

export declare type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never;
declare type _TupleOf<ArrayElementGeneric, LengthGeneric extends number, FullArrayGeneric extends unknown[]> = FullArrayGeneric['length'] extends LengthGeneric ? FullArrayGeneric : _TupleOf<ArrayElementGeneric, LengthGeneric, [ArrayElementGeneric, ...FullArrayGeneric]>;
export declare type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = readonly [
export type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never;
type _TupleOf<ArrayElementGeneric, LengthGeneric extends number, FullArrayGeneric extends unknown[]> = FullArrayGeneric['length'] extends LengthGeneric ? FullArrayGeneric : _TupleOf<ArrayElementGeneric, LengthGeneric, [ArrayElementGeneric, ...FullArrayGeneric]>;
export type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = readonly [
...Tuple<ArrayElementGeneric, LengthGeneric>,

@@ -9,1 +9,2 @@ ...ArrayElementGeneric[]

export {};
//# sourceMappingURL=tuple.d.ts.map

@@ -0,9 +1,10 @@

import { AnyFunction } from '@augment-vir/common';
declare function getTypeOf(x: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
export declare type TypeOf = ReturnType<typeof getTypeOf>;
export declare type TypeOfWithArray = TypeOf | 'array';
export declare type TypeOfMapping = {
export type TypeOf = ReturnType<typeof getTypeOf>;
export type TypeOfWithArray = TypeOf | 'array';
export type TypeOfMapping = {
array: any[];
bigint: bigint;
boolean: boolean;
function: (...args: any[]) => any;
function: AnyFunction;
number: number;

@@ -18,1 +19,2 @@ object: object;

export {};
//# sourceMappingURL=type-of.d.ts.map
/** Makes all properties in an object writable. This is the opposite of Readonly<> */
export declare type Writeable<T> = {
export type Writeable<T> = {
-readonly [P in keyof T]: T[P];
};
/** Makes all property values in an object also readonly. Can cause issues on primitive. */
export declare type DeepWriteable<T> = {
export type DeepWriteable<T> = {
-readonly [P in keyof T]: DeepWriteable<T[P]>;
};
/** Replace properties in T with properties in U. */
export declare type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
/** Extract the element type out of an array type. */
export declare type ArrayElement<ArrayType extends ReadonlyArray<any>> = ArrayType[number];
export type ArrayElement<ArrayType extends ReadonlyArray<any>> = ArrayType[number];
/**

@@ -17,7 +17,7 @@ * Same as the Required<> built-in type helper but this requires that each property be present and

*/
export declare type RequiredAndNotNull<T> = {
export type RequiredAndNotNull<T> = {
[P in keyof T]-?: NonNullable<T[P]>;
};
/** Require only a subset of object properties. */
export declare type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
export type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
/**

@@ -27,8 +27,8 @@ * Require only a subset of object properties and require that they be not null. This is

*/
export declare type RequiredAndNotNullBy<T, K extends keyof T> = Omit<T, K> & Required<{
export type RequiredAndNotNullBy<T, K extends keyof T> = Omit<T, K> & Required<{
[PropertyName in K]: NonNullable<T[PropertyName]>;
}>;
/** If type T = type U, then type Y. Else type N. */
export declare type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? Y : N;
export declare type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
export type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? Y : N;
export type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
/**

@@ -48,3 +48,3 @@ * This function returns another function that simply returns whatever input it's given. However, it

*/
export declare type NoInfer<T> = [T][T extends any ? 0 : never];
export type NoInfer<T> = [T][T extends any ? 0 : never];
/**

@@ -58,1 +58,2 @@ * This is a type helper that ensures the given input matches the given generic type. The generic is

export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>;
//# sourceMappingURL=type.d.ts.map

@@ -16,1 +16,2 @@ export * from './augments/ansi';

export * from './augments/type-of';
//# sourceMappingURL=index.d.ts.map
{
"name": "@augment-vir/common",
"version": "5.0.1",
"version": "6.0.0",
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",

@@ -22,19 +22,7 @@ "bugs": {

"compile": "tsc --project tsconfig.json && tsc --project tsconfig.cjs.json && tsc --project tsconfig.esm.json",
"docs:update": "virmator code-in-markdown",
"test": "echo \"use common-test to run tests\" && exit 0"
},
"dependencies": {
"type-fest": "^3.2.0"
"type-fest": "^3.3.0"
},
"devDependencies": {
"istanbul-smart-text-reporter": "^1.0.0",
"prettier": "^2.7.1",
"prettier-plugin-jsdoc": "^0.4.2",
"prettier-plugin-multiline-arrays": "^1.1.1",
"prettier-plugin-organize-imports": "^3.2.0",
"prettier-plugin-packagejson": "^2.3.0",
"prettier-plugin-sort-json": "^0.0.3",
"prettier-plugin-toml": "^0.3.1",
"typescript": "^4.8.4"
},
"publishConfig": {

@@ -41,0 +29,0 @@ "access": "public"

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