@bunt/util
Advanced tools
Comparing version 0.24.38 to 0.24.48
@@ -1,4 +0,4 @@ | ||
export declare type AssertionDetailsAllowType = string | Record<any, any> | null | number; | ||
export declare type AssertionDetails = (() => AssertionDetailsAllowType) | AssertionDetailsAllowType; | ||
export declare type AssertionMessage = string | (() => string) | (() => Error); | ||
export type AssertionDetailsAllowType = string | Record<any, any> | null | number; | ||
export type AssertionDetails = (() => AssertionDetailsAllowType) | AssertionDetailsAllowType; | ||
export type AssertionMessage = string | (() => string) | (() => Error); | ||
export declare function assert(expr: unknown, message?: AssertionMessage, details?: AssertionDetails): asserts expr; | ||
@@ -5,0 +5,0 @@ export declare function validateTrue(result: true | string, details?: AssertionDetails): void; |
@@ -1,3 +0,3 @@ | ||
declare type DeferOnFulfilled<T, TResult1> = ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null; | ||
declare type DeferOnRejected<TResult2> = ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null; | ||
type DeferOnFulfilled<T, TResult1> = ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null; | ||
type DeferOnRejected<TResult2> = ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null; | ||
export declare class Defer<T> implements PromiseLike<T> { | ||
@@ -4,0 +4,0 @@ #private; |
@@ -1,3 +0,3 @@ | ||
export declare type DateTimeKind = "ms" | "sec" | "min" | "hour" | "day" | "month" | "week" | "year"; | ||
export declare type TimeMutateFn = (date: number, value: number) => number; | ||
export type DateTimeKind = "ms" | "sec" | "min" | "hour" | "day" | "month" | "week" | "year"; | ||
export type TimeMutateFn = (date: number, value: number) => number; | ||
export declare enum TimeMultiply { | ||
@@ -9,3 +9,3 @@ SEC = 1000, | ||
} | ||
export declare type DateConfig = { | ||
export type DateConfig = { | ||
locale: string; | ||
@@ -12,0 +12,0 @@ timeZone: string; |
@@ -6,5 +6,5 @@ import { Promisify } from "./interfaces"; | ||
export declare function makeSafe<A extends any[], R>(fn: (...args: A) => Promise<R>): (...args: A) => Promise<R | undefined>; | ||
export declare type ValueToArray<T> = T extends any[] ? T : T[]; | ||
export type ValueToArray<T> = T extends any[] ? T : T[]; | ||
export declare function toArray<T>(value: T): ValueToArray<T>; | ||
export declare function voidify<T extends Promise<unknown>>(value: T): Promise<void>; | ||
export declare function safeMap<T>(values: Iterable<T>, fn: (value: T) => Promisify<any>): Promise<unknown[]>; |
@@ -19,1 +19,2 @@ export * from "./is"; | ||
export * from "./interfaces"; | ||
export * from "./qs"; |
@@ -35,2 +35,3 @@ "use strict"; | ||
__exportStar(require("./interfaces"), exports); | ||
__exportStar(require("./qs"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,12 +0,12 @@ | ||
export declare type Promisify<T> = T | Promise<T>; | ||
export declare type Ctor<T = any, A extends any[] = any[]> = new (...args: A) => T; | ||
export declare type Newable<T = any> = NewableFunction & { | ||
export type Promisify<T> = T | Promise<T>; | ||
export type Ctor<T = any, A extends any[] = any[]> = new (...args: A) => T; | ||
export type Newable<T = any> = NewableFunction & { | ||
prototype: T; | ||
}; | ||
export declare type Func<TReturn = any, TArgs extends any[] = any[], This = any> = (this: This, ...args: TArgs) => TReturn; | ||
export declare type ConstructorFunction<T, A extends any[] = any[]> = (...args: A) => T; | ||
export declare type DecoratorTarget = Object; | ||
export declare type MaybeArray<T> = T | T[]; | ||
export declare type MayNullable<T> = T | null | undefined; | ||
export declare type Fn<A extends any[] = [], R = void> = (...args: A) => R; | ||
export declare type KeyOf<T extends Record<string, any>> = Exclude<keyof T, number | symbol>; | ||
export type Func<TReturn = any, TArgs extends any[] = any[], This = any> = (this: This, ...args: TArgs) => TReturn; | ||
export type ConstructorFunction<T, A extends any[] = any[]> = (...args: A) => T; | ||
export type DecoratorTarget = Object; | ||
export type MaybeArray<T> = T | T[]; | ||
export type MayNullable<T> = T | null | undefined; | ||
export type Fn<A extends any[] = [], R = void> = (...args: A) => R; | ||
export type KeyOf<T extends Record<string, any>> = Exclude<keyof T, number | symbol>; |
@@ -17,5 +17,5 @@ import { Ctor, Newable } from "./interfaces"; | ||
export declare const isError: (value: unknown) => value is Error; | ||
export declare type IIS<T> = T extends Ctor<infer S> ? S : T extends Newable<infer S> ? S : T; | ||
export type IIS<T> = T extends Ctor<infer S> ? S : T extends Newable<infer S> ? S : T; | ||
export declare const isInstanceOf: <C extends Ctor<any, any[]> | Newable<any>>(value: unknown, type: C) => value is IIS<C>; | ||
export declare function isRejected<T>(item: PromiseSettledResult<T>): item is PromiseRejectedResult; | ||
export declare function isFulfilled<T>(item: PromiseSettledResult<T>): item is PromiseFulfilledResult<T>; |
@@ -23,12 +23,12 @@ import { Func, Promisify } from "../interfaces"; | ||
} | ||
export declare type LoggerOwner = Record<any, any> | ILogger | Func; | ||
export declare type LogableType = string | Record<any, any> | number | bigint | null | undefined | boolean | Date | unknown; | ||
export type LoggerOwner = Record<any, any> | ILogger | Func; | ||
export type LogableType = string | Record<any, any> | number | bigint | null | undefined | boolean | Date | unknown; | ||
export interface ILogable<T extends LogableType> { | ||
getLogValue(): T; | ||
} | ||
export declare type Logable = ILogable<LogableType> | LogableType | Logable[]; | ||
export declare type LogFn = (message: string, ...args: Logable[]) => void; | ||
export declare type LogWrapFn = (logger: Logger, message: string, ...args: LogableType[]) => void; | ||
export declare type LogFormat<T> = (log: LogMessage) => T; | ||
export declare type LogSystemInfo = { | ||
export type Logable = ILogable<LogableType> | LogableType | Logable[]; | ||
export type LogFn = (message: string, ...args: Logable[]) => void; | ||
export type LogWrapFn = (logger: Logger, message: string, ...args: LogableType[]) => void; | ||
export type LogFormat<T> = (log: LogMessage) => T; | ||
export type LogSystemInfo = { | ||
arch: string; | ||
@@ -42,3 +42,3 @@ platform: string; | ||
}; | ||
export declare type LogMessage = { | ||
export type LogMessage = { | ||
pid: number; | ||
@@ -45,0 +45,0 @@ host: string; |
@@ -7,3 +7,3 @@ import { Promisify } from "../../interfaces"; | ||
} | ||
export declare type LoggerWritableStream<T> = ILoggerStreamCallback<T>; | ||
export type LoggerWritableStream<T> = ILoggerStreamCallback<T>; | ||
export declare abstract class InOutTransportAbstract<T> implements ILoggerTransport { | ||
@@ -10,0 +10,0 @@ #private; |
@@ -1,4 +0,4 @@ | ||
export declare type XMapArrayFactory<K, V> = (value: V, index: number, array: V[]) => K; | ||
export declare type XMapInitializer<K, V> = (key: K) => V; | ||
export declare type XMapArgs<K, V> = [ | ||
export type XMapArrayFactory<K, V> = (value: V, index: number, array: V[]) => K; | ||
export type XMapInitializer<K, V> = (key: K) => V; | ||
export type XMapArgs<K, V> = [ | ||
values: [K, V][], | ||
@@ -5,0 +5,0 @@ initializer?: (key: K) => V |
@@ -1,2 +0,2 @@ | ||
export declare type ArgvParse = { | ||
export type ArgvParse = { | ||
args: Set<string>; | ||
@@ -3,0 +3,0 @@ options: Map<string, string>; |
/// <reference types="node" /> | ||
import { KeyOf } from "../interfaces"; | ||
import { Dict } from "./interfaces"; | ||
export declare type EnvValue = string | undefined; | ||
export type EnvValue = string | undefined; | ||
export declare class Env<T extends Dict<string>> { | ||
@@ -6,0 +6,0 @@ #private; |
/// <reference types="node" /> | ||
export declare type Dict<T> = NodeJS.Dict<T>; | ||
export type Dict<T> = NodeJS.Dict<T>; |
@@ -7,2 +7,2 @@ export interface IPerfValue { | ||
} | ||
export declare type PerfLabel = (string | Record<any, any>); | ||
export type PerfLabel = (string | Record<any, any>); |
/// <reference types="node" /> | ||
import { Duplex, Readable, Stream, Transform, Writable } from "stream"; | ||
declare type IsStream = Readable | Writable | Duplex | Transform | Stream; | ||
type IsStream = Readable | Writable | Duplex | Transform | Stream; | ||
declare const isStream: (stream: unknown) => stream is IsStream; | ||
@@ -5,0 +5,0 @@ declare const isWritableStream: (stream: unknown) => stream is Writable; |
import { Promisify } from "../interfaces"; | ||
export declare type TypeToJSON<T> = T extends Date ? string | number : any; | ||
export declare type TransformFunction<T> = (value: TypeToJSON<T>) => Promisify<T>; | ||
export declare type TransformSchema<T> = T extends Array<infer E> ? TransformSchemaObject<E> : TransformSchemaObject<T>; | ||
export declare type TransformSchemaObject<T> = { | ||
export type TypeToJSON<T> = T extends Date ? string | number : any; | ||
export type TransformFunction<T> = (value: TypeToJSON<T>) => Promisify<T>; | ||
export type TransformSchema<T> = T extends Array<infer E> ? TransformSchemaObject<E> : TransformSchemaObject<T>; | ||
export type TransformSchemaObject<T> = { | ||
[K in keyof T]?: T[K] extends Array<infer S> ? S extends Record<any, any> ? TransformFunction<S> | TransformSchemaObject<S> : TransformFunction<S> : T[K] extends Record<any, any> ? TransformFunction<T[K]> | TransformSchemaObject<T[K]> : TransformFunction<T[K]>; | ||
}; | ||
export declare type JSONInput<T> = T extends Array<infer E> ? JSONInput<E>[] : T extends Record<any, any> ? { | ||
export type JSONInput<T> = T extends Array<infer E> ? JSONInput<E>[] : T extends Record<any, any> ? { | ||
[K in keyof T]: T[K] extends Array<infer S> ? Array<JSONInput<S>> : JSONInput<T[K]>; | ||
} : T extends Date ? string | number : any; | ||
export declare type Transformable = Record<any, any> | Record<any, any>[]; | ||
export declare type TransformOut<T, S extends TransformSchema<T> = TransformSchema<T>> = T extends Array<infer E> ? { | ||
export type Transformable = Record<any, any> | Record<any, any>[]; | ||
export type TransformOut<T, S extends TransformSchema<T> = TransformSchema<T>> = T extends Array<infer E> ? { | ||
[K in keyof E]: K extends keyof S ? S[K] extends () => infer R ? R : E[K] : E[K]; | ||
@@ -14,0 +14,0 @@ }[] : { |
{ | ||
"name": "@bunt/util", | ||
"version": "0.24.38", | ||
"version": "0.24.48", | ||
"keywords": [ | ||
@@ -29,3 +29,3 @@ "typescript" | ||
"license": "MIT", | ||
"gitHead": "df5bf8bc02d45db31f7d530522e158112fce82bf" | ||
"gitHead": "77abba471db8ca46f16628c168658419ef62d8a5" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
196873
179
2208