@goodbyenjn/utils 26.2.0 → 26.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,174 @@
1
+ import { d as SyncFn, s as AsyncFn, t as index_d_exports } from "./chunk-3c6f28c7.js";
2
+
3
+ //#region src/result/types.d.ts
4
+ type ExtractOkTypes<T extends readonly Result[]> = { [K in keyof T]: T[K] extends Result<infer U, unknown> ? U : never };
5
+ type ExtractErrTypes<T extends readonly Result[]> = { [K in keyof T]: T[K] extends Result<unknown, infer E> ? E : never };
6
+ type InferOkType<R> = R extends Result<infer T, unknown> ? T : never;
7
+ type InferErrType<R> = R extends Result<unknown, infer E> ? E : never;
8
+ type ResultAll<T extends readonly Result[]> = IsLiteralArray<T> extends 1 ? Traverse<T> : Result<ExtractOkTypes<T>, ExtractErrTypes<T>[number]>;
9
+ type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, ...0[]];
10
+ type CollectResults<T, Collected extends unknown[] = [], Depth extends number = 50> = [Depth] extends [never] ? [] : T extends [infer H, ...infer Rest] ? H extends Result<infer L, infer R> ? CollectResults<Rest, [...Collected, [L, R]], Prev[Depth]> : never : Collected;
11
+ type Transpose<A, Transposed extends unknown[][] = [], Depth extends number = 10> = A extends [infer T, ...infer Rest] ? T extends [infer L, infer R] ? Transposed extends [infer PL, infer PR] ? PL extends unknown[] ? PR extends unknown[] ? Transpose<Rest, [[...PL, L], [...PR, R]], Prev[Depth]> : never : never : Transpose<Rest, [[L], [R]], Prev[Depth]> : Transposed : Transposed;
12
+ type Combine<T, Depth extends number = 5> = Transpose<CollectResults<T>, [], Depth> extends [infer L, infer R] ? [UnknownMembersToNever<L>, UnknownMembersToNever<R>] : Transpose<CollectResults<T>, [], Depth> extends [] ? [[], []] : never;
13
+ type EmptyArrayToNever<T, NeverArrayToNever extends number = 0> = T extends [] ? never : NeverArrayToNever extends 1 ? T extends [never, ...infer Rest] ? [EmptyArrayToNever<Rest>] extends [never] ? never : T : T : T;
14
+ type UnknownMembersToNever<T> = T extends [infer H, ...infer R] ? [[unknown] extends [H] ? never : H, ...UnknownMembersToNever<R>] : T;
15
+ type MembersToUnion<T> = T extends unknown[] ? T[number] : never;
16
+ type IsLiteralArray<T> = T extends {
17
+ length: infer L;
18
+ } ? L extends number ? number extends L ? 0 : 1 : 0 : 0;
19
+ type Traverse<T, Depth extends number = 5> = Combine<T, Depth> extends [infer Oks, infer Errs] ? Result<EmptyArrayToNever<Oks, 1>, MembersToUnion<Errs>> : never;
20
+ //#endregion
21
+ //#region src/result/result.d.ts
22
+ type Ok<T = unknown> = Result<T, never>;
23
+ type Err<E = unknown> = Result<never, E>;
24
+ declare class Result<T = unknown, E = unknown> {
25
+ #private;
26
+ static is(value: unknown): value is Result;
27
+ static ok(): Ok<void>;
28
+ static ok<T>(value: T): Ok<T>;
29
+ static err(): Err<void>;
30
+ static err<E>(error: E): Err<E>;
31
+ /**
32
+ * Creates a `Result` from a function or a promise, catching any thrown errors or rejected promises.
33
+ */
34
+ static try<T, E = unknown>(fn: SyncFn<T>): Result<T, E>;
35
+ static try<T>(fn: SyncFn<T>, onThrow: ErrorConstructor): Result<T, Error>;
36
+ static try<T, E>(fn: SyncFn<T>, onThrow: (error: unknown) => E): Result<T, E>;
37
+ static try<T, E = unknown>(fn: AsyncFn<T>): Promise<Result<Awaited<T>, E>>;
38
+ static try<T>(fn: AsyncFn<T>, onThrowOrReject: ErrorConstructor): Promise<Result<Awaited<T>, Error>>;
39
+ static try<T, E>(fn: AsyncFn<T>, onThrowOrReject: (error: unknown) => E): Promise<Result<Awaited<T>, E>>;
40
+ static try<T, E = unknown>(promise: PromiseLike<T>): Promise<Result<Awaited<T>, E>>;
41
+ static try<T>(promise: PromiseLike<T>, onReject: ErrorConstructor): Promise<Result<Awaited<T>, Error>>;
42
+ static try<T, E>(promise: PromiseLike<T>, onReject: (error: unknown) => E): Promise<Result<Awaited<T>, E>>;
43
+ /**
44
+ * Wraps a function and returns a new function that always returns a `Result`, catching any thrown errors or rejected promises.
45
+ */
46
+ static wrap<A extends any[], T, E = unknown>(fn: SyncFn<T, A>): SyncFn<Result<T, E>, A>;
47
+ static wrap<A extends any[], T>(fn: SyncFn<T, A>, onThrow: ErrorConstructor): SyncFn<Result<T, Error>, A>;
48
+ static wrap<A extends any[], T, E>(fn: SyncFn<T, A>, onThrow: (error: unknown) => E): SyncFn<Result<T, E>, A>;
49
+ static wrap<A extends any[], T, E = unknown>(fn: AsyncFn<T, A>): AsyncFn<Result<Awaited<T>, E>, A>;
50
+ static wrap<A extends any[], T>(fn: AsyncFn<T, A>, onThrowOrReject: ErrorConstructor): AsyncFn<Result<Awaited<T>, Error>, A>;
51
+ static wrap<A extends any[], T, E>(fn: AsyncFn<T, A>, onThrowOrReject: (error: unknown) => E): AsyncFn<Result<Awaited<T>, E>, A>;
52
+ /**
53
+ * Combines multiple `Result` instances into one `Result` containing an array of all `Ok` values,
54
+ * or the first `Err` encountered
55
+ */
56
+ static all<T extends index_d_exports.NonEmptyTuple<Result>>(results: T): ResultAll<T>;
57
+ static all<T extends readonly Result[]>(results: T): ResultAll<T>;
58
+ /**
59
+ * Wraps a generator function where `yield` can return `Err` values early.
60
+ * If the generator completes, the returned value is wrapped in `Ok`.
61
+ */
62
+ static gen<T, E, This>(body: (this: This) => Iterator<Err<E>, Result<T, E> | T>, self?: This): Result<T, E>;
63
+ static gen<YieldErr extends Err, ReturnResult extends Result | any, This>(body: (this: This) => Iterator<YieldErr, ReturnResult>, self?: This): Result<ReturnResult extends Result ? InferOkType<ReturnResult> : ReturnResult, InferErrType<YieldErr> | (ReturnResult extends Result ? InferErrType<ReturnResult> : never)>;
64
+ static gen<T, E, This>(body: (this: This) => AsyncIterator<Err<E>, Result<T, E> | T>, self?: This): Promise<Result<T, E>>;
65
+ static gen<YieldErr extends Err, ReturnResult extends Result | any, This>(body: (this: This) => AsyncIterator<YieldErr, ReturnResult>, self?: This): Promise<Result<ReturnResult extends Result ? InferOkType<ReturnResult> : ReturnResult, InferErrType<YieldErr> | (ReturnResult extends Result ? InferErrType<ReturnResult> : never)>>;
66
+ private ok;
67
+ private value;
68
+ private error;
69
+ private get contexts();
70
+ private constructor();
71
+ /**
72
+ * Check if `Result` is `OK`
73
+ */
74
+ isOk(): this is Ok<T>;
75
+ /**
76
+ * Check if `Result` is `OK` and the value matches the predicate
77
+ */
78
+ isOkAnd(predicate: (value: T) => boolean): this is Ok<T>;
79
+ /**
80
+ * Check if `Result` is `Err`
81
+ */
82
+ isErr(): this is Err<E>;
83
+ /**
84
+ * Check if `Result` is `Err` and the error matches the predicate
85
+ */
86
+ isErrAnd(predicate: (error: E) => boolean): this is Err<E>;
87
+ /**
88
+ * Maps `Result<T, E>` to `Result<U, E>` or `Promise<Result<U, E>>`
89
+ */
90
+ map<U>(fn: (value: T) => U): Result<U, E>;
91
+ map<U>(fn: (value: T) => Promise<U>): Promise<Result<U, E>>;
92
+ /**
93
+ * Maps `Result<T, E>` to `Result<T, F>` or `Promise<Result<T, F>>`
94
+ */
95
+ mapErr<F>(fn: (error: E) => F): Result<T, F>;
96
+ mapErr<F>(fn: (error: E) => Promise<F>): Promise<Result<T, F>>;
97
+ /**
98
+ * Returns given `result` if `Result` is `Ok`, otherwise returns `Result` directly
99
+ */
100
+ and<R extends Result<unknown, E>>(result: R): Result<InferOkType<R>, E>;
101
+ and<U>(result: Result<U, E>): Result<U, E>;
102
+ and<R extends Promise<Result<unknown, E>>>(result: R): Promise<Result<InferOkType<R>, E>>;
103
+ and<U>(result: Promise<Result<U, E>>): Promise<Result<U, E>>;
104
+ /**
105
+ * Maps `Result<T, E>` to `Result<U, E | F>` or `Promise<Result<U, E | F>>` with a function
106
+ */
107
+ andThen<R extends Result>(fn: (value: T) => R): Result<InferOkType<R>, InferErrType<R> | E>;
108
+ andThen<U, F>(fn: (value: T) => Result<U, F>): Result<U, E | F>;
109
+ andThen<R extends Promise<Result>>(fn: (value: T) => R): Promise<Result<InferOkType<R>, InferErrType<R> | E>>;
110
+ andThen<U, F>(fn: (value: T) => Promise<Result<U, F>>): Promise<Result<U, E | F>>;
111
+ /**
112
+ * Returns given `result` if `Result` is `Err`, otherwise returns `Result` directly
113
+ */
114
+ or<R extends Result<T, unknown>>(result: R): Result<T, InferErrType<R>>;
115
+ or<F>(result: Result<T, F>): Result<T, F>;
116
+ or<R extends Promise<Result<T, unknown>>>(result: R): Promise<Result<T, InferErrType<R>>>;
117
+ or<F>(result: Promise<Result<T, F>>): Promise<Result<T, F>>;
118
+ /**
119
+ * Maps `Result<T, E>` to `Result<T | U, F>` or `Promise<Result<U, E | F>>` with a function
120
+ */
121
+ orElse<R extends Result>(fn: (error: E) => R): Result<InferOkType<R> | T, InferErrType<R>>;
122
+ orElse<U, F>(fn: (error: E) => Result<U, F>): Result<T | U, F>;
123
+ orElse<R extends Promise<Result>>(fn: (error: E) => R): Promise<Result<InferOkType<R> | T, InferErrType<R>>>;
124
+ orElse<U, F>(fn: (error: E) => Promise<Result<U, F>>): Promise<Result<T | U, F>>;
125
+ /**
126
+ * Calls the function with the value if `Result` is `Ok` and returns the result unchanged
127
+ */
128
+ inspect(fn: (value: T) => unknown): Result<T, E>;
129
+ /**
130
+ * Calls the function with the error if `Result` is `Err` and returns the result unchanged
131
+ */
132
+ inspectErr(fn: (error: E) => unknown): Result<T, E>;
133
+ /**
134
+ * Unwrap the `Ok` value, or throw an error if `Result` is `Err`
135
+ */
136
+ unwrap(message?: string | null): T;
137
+ /**
138
+ * Unwrap the `Err` value, or throw an error if `Result` is `Ok`
139
+ */
140
+ unwrapErr(message?: string | null): E;
141
+ /**
142
+ * Unwrap the `Ok` value, or return the provided value if `Result` is `Err`
143
+ */
144
+ unwrapOr(defaultValue: T): T;
145
+ /**
146
+ * Unwrap the `Ok` value, or compute it from a function if `Result` is `Err`
147
+ */
148
+ unwrapOrElse(defaultValueGetter: (error: E) => T): T;
149
+ /**
150
+ * Matches the `Result` variant and executes the corresponding function
151
+ */
152
+ match<U, F = U>(ok: (value: T) => U, err: (error: E) => F): U | F;
153
+ /**
154
+ * Returns an iterable object that yields the `Ok` value and `Err` value
155
+ */
156
+ iter(): [ok: true, error: never, value: T] | [ok: false, error: E, value: never];
157
+ [Symbol.iterator](): Iterator<Err<E>, T>;
158
+ context(context: string): this;
159
+ }
160
+ declare const ok: typeof Result.ok;
161
+ declare const err: typeof Result.err;
162
+ //#endregion
163
+ //#region src/result/error.d.ts
164
+ declare class ResultError extends Error {
165
+ #private;
166
+ static is(value: unknown): value is ResultError;
167
+ static fmt(result: Result, message?: string): string;
168
+ constructor(result: Result, message?: string, caller?: Function);
169
+ get msg(): string;
170
+ get contexts(): string[];
171
+ toString(): string;
172
+ }
173
+ //#endregion
174
+ export { err as a, ExtractOkTypes as c, ResultAll as d, Result as i, InferErrType as l, Err as n, ok as o, Ok as r, ExtractErrTypes as s, ResultError as t, InferOkType as u };
@@ -0,0 +1,43 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) {
12
+ __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ }
17
+ if (!no_symbols) {
18
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
19
+ }
20
+ return target;
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
25
+ key = keys[i];
26
+ if (!__hasOwnProp.call(to, key) && key !== except) {
27
+ __defProp(to, key, {
28
+ get: ((k) => from[k]).bind(null, key),
29
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
+ });
31
+ }
32
+ }
33
+ }
34
+ return to;
35
+ };
36
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
38
+ value: mod,
39
+ enumerable: true
40
+ }) : target, mod));
41
+
42
+ //#endregion
43
+ export { __toESM as i, __exportAll as n, __reExport as r, __commonJSMin as t };
@@ -0,0 +1,27 @@
1
+ import { add, addProp, allPass, anyPass, capitalize, ceil, chunk, clamp, clone, concat, conditional, constant, countBy, debounce, defaultTo, difference, differenceWith, divide, doNothing, drop, dropFirstBy, dropLast, dropLastWhile, dropWhile, endsWith, entries, evolve, filter, find, findIndex, findLast, findLastIndex, first, firstBy, flat, flatMap, floor, forEach, forEachObj, fromEntries, fromKeys, funnel, groupBy, groupByProp, hasAtLeast, hasSubObject, identity, indexBy, intersection, intersectionWith, invert, isArray, isBigInt, isBoolean, isDate, isDeepEqual, isDefined, isEmpty, isEmptyish, isError, isFunction, isIncludedIn, isNonNull, isNonNullish, isNot, isNullish, isNumber, isObjectType, isObjectType as isObjectType$1, isPlainObject, isPromise, isShallowEqual, isStrictEqual, isString, isSymbol, isTruthy, join, keys, last, length, map, mapKeys, mapToObj, mapValues, mapWithFeedback, mean, meanBy, median, merge, mergeAll, mergeDeep, multiply, nthBy, objOf, omit, omitBy, once, only, partialBind, partialLastBind, partition, pathOr, pick, pickBy, pipe, piped, product, prop, pullObject, purry, purry as purry$1, randomBigInt, randomInteger, randomString, range, rankBy, reduce, reverse, round, sample, set, setPath, shuffle, sliceString, sort, sortBy, sortedIndex, sortedIndexBy, sortedIndexWith, sortedLastIndex, sortedLastIndexBy, splice, split, splitAt, splitWhen, startsWith, stringToPath, subtract, sum, sumBy, swapIndices, swapProps, take, takeFirstBy, takeLast, takeLastWhile, takeWhile, tap, times, toCamelCase, toKebabCase, toLowerCase, toSnakeCase, toTitleCase, toUpperCase, truncate, uncapitalize, unique, uniqueBy, uniqueWith, values, when, zip, zipWith } from "remeda";
2
+ import { accumulateAsync as accumulateP, accumulateSync as accumulate, awaitAll, buffer, chunkAsync as chunkP, compose, concatAsync as concatP, concurrency, differenceAsync as differenceP, differenceByAsync as differenceByP, differenceBySync as differenceBy, differenceWithAsync as differenceWithP, dropAsync as dropP, everyAsync as everyP, everySync as every, executeAsync as executeP, executeSync as execute, filterAsync as filterP, findAsync as findP, flatMapAsync as flatMapP, flattenAsync as flattenP, flattenSync as flatten, forEachAsync as forEachP, intersectionAsync as intersectionP, intersectionByAsync as intersectionByP, intersectionBySync as intersectionBy, intersectionWithAsync as intersectionWithP, mapAsync as mapP, peekAsync as peekP, peekSync as peek, reduceAsync as reduceP, serializeAsync as serializeP, serializeSync as serialize, someAsync as someP, someSync as some, takeAsync as takeP, throttle, toArrayAsync as toArrayP, toArraySync as toArray, toIteratorAsync as toIteratorP, toIteratorSync as toIterator, uniqueAsync as uniqueP, uniqueByAsync as uniqueByP, uniqueWithAsync as uniqueWithP } from "rotery";
3
+
4
+ //#region src/remeda/hasOwnProperty.ts
5
+ function hasOwnProperty(...args) {
6
+ return purry(hasOwnPropertyImplementation, args);
7
+ }
8
+ function hasOwnPropertyImplementation(data, properties) {
9
+ if (!isObjectType(data)) return false;
10
+ for (const property of properties) if (!Object.hasOwn(data, property)) return false;
11
+ return true;
12
+ }
13
+
14
+ //#endregion
15
+ //#region src/remeda/isFunction.ts
16
+ function isFunction$1(data) {
17
+ return typeof data === "function";
18
+ }
19
+
20
+ //#endregion
21
+ //#region src/remeda/isPromiseLike.ts
22
+ function isPromiseLike(data) {
23
+ return isObjectType(data) && isFunction(data.then) && Object.getOwnPropertyDescriptor(data, "then")?.get === void 0;
24
+ }
25
+
26
+ //#endregion
27
+ export { firstBy as $, sortedIndexWith as $n, mapKeys as $t, divide as A, purry$1 as An, toTitleCase as Ar, isDefined as At, every as B, sample as Bn, values as Br, isObjectType$1 as Bt, defaultTo as C, pick as Cn, toArrayP as Cr, intersectionWithP as Ct, differenceP as D, product as Dn, toKebabCase as Dr, isBoolean as Dt, differenceByP as E, piped as En, toIteratorP as Er, isBigInt as Et, dropLastWhile as F, rankBy as Fn, uniqueBy as Fr, isNonNull as Ft, filter as G, shuffle as Gn, isFunction$1 as Gr, isString as Gt, evolve as H, serializeP as Hn, zip as Hr, isPromise as Ht, dropP as I, reduce as In, uniqueByP as Ir, isNonNullish as It, findIndex as J, someP as Jn, join as Jt, filterP as K, sliceString as Kn, hasOwnProperty as Kr, isSymbol as Kt, dropWhile as L, reduceP as Ln, uniqueP as Lr, isNot as Lt, drop as M, randomInteger as Mn, truncate as Mr, isEmptyish as Mt, dropFirstBy as N, randomString as Nn, uncapitalize as Nr, isError as Nt, differenceWith as O, prop as On, toLowerCase as Or, isDate as Ot, dropLast as P, range as Pn, unique as Pr, isIncludedIn as Pt, first as Q, sortedIndexBy as Qn, map as Qt, endsWith as R, reverse as Rn, uniqueWith as Rr, isNullish as Rt, debounce as S, peekP as Sn, toArray as Sr, intersectionWith as St, differenceBy as T, pipe as Tn, toIterator as Tr, isArray as Tt, execute as U, set as Un, zipWith as Ur, isShallowEqual as Ut, everyP as V, serialize as Vn, when as Vr, isPlainObject as Vt, executeP as W, setPath as Wn, isPromiseLike as Wr, isStrictEqual as Wt, findLastIndex as X, sortBy as Xn, last as Xt, findLast as Y, sort as Yn, keys as Yt, findP as Z, sortedIndex as Zn, length as Zt, concatP as _, partialBind as _n, takeP as _r, indexBy as _t, allPass as a, meanBy as an, splitWhen as ar, floor as at, constant as b, pathOr as bn, throttle as br, intersectionByP as bt, buffer as c, mergeAll as cn, subtract as cr, forEachP as ct, chunk as d, nthBy as dn, swapIndices as dr, funnel as dt, mapP as en, sortedLastIndex as er, flat as et, chunkP as f, objOf as fn, swapProps as fr, groupBy as ft, concat as g, only as gn, takeLastWhile as gr, identity as gt, compose as h, once as hn, takeLast as hr, hasSubObject as ht, addProp as i, mean as in, splitAt as ir, flattenP as it, doNothing as j, randomBigInt as jn, toUpperCase as jr, isEmpty as jt, differenceWithP as k, pullObject as kn, toSnakeCase as kr, isDeepEqual as kt, capitalize as l, mergeDeep as ln, sum as lr, fromEntries as lt, clone as m, omitBy as mn, takeFirstBy as mr, hasAtLeast as mt, accumulateP as n, mapValues as nn, splice as nr, flatMapP as nt, anyPass as o, median as on, startsWith as or, forEach as ot, clamp as p, omit as pn, take as pr, groupByProp as pt, find as q, some as qn, isTruthy as qt, add as r, mapWithFeedback as rn, split as rr, flatten as rt, awaitAll as s, merge as sn, stringToPath as sr, forEachObj as st, accumulate as t, mapToObj as tn, sortedLastIndexBy as tr, flatMap as tt, ceil as u, multiply as un, sumBy as ur, fromKeys as ut, concurrency as v, partialLastBind as vn, takeWhile as vr, intersection as vt, difference as w, pickBy as wn, toCamelCase as wr, invert as wt, countBy as x, peek as xn, times as xr, intersectionP as xt, conditional as y, partition as yn, tap as yr, intersectionBy as yt, entries as z, round as zn, uniqueWithP as zr, isNumber as zt };
package/dist/common.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as Result } from "./chunks/chunk-d1860346.js";
2
- import { ai as Fn, ri as AsyncFn } from "./chunks/chunk-e931fe39.js";
1
+ import { i as Result } from "./chunks/chunk-704a1835.js";
2
+ import { l as Fn, p as TemplateFn, s as AsyncFn } from "./chunks/chunk-3c6f28c7.js";
3
3
 
4
4
  //#region src/common/error.d.ts
5
5
  declare const normalizeError: (error: unknown, caller?: Function) => Error;
@@ -46,7 +46,7 @@ declare const scale: (value: number, inRange: [min: number, max: number], outRan
46
46
  //#endregion
47
47
  //#region src/common/parse.d.ts
48
48
  declare const parseKeyValuePairs: (input: string) => Record<string, string>;
49
- declare const parseValueToBoolean: (value: unknown, defaultValue: boolean) => boolean;
49
+ declare const parseValueToBoolean: <T>(value: unknown, defaultValue: T | boolean) => T | boolean;
50
50
  //#endregion
51
51
  //#region src/common/promise.d.ts
52
52
  interface Singleton<T> {
@@ -94,13 +94,6 @@ declare const joinWithSlash: (...paths: string[]) => string;
94
94
  declare const splitWithSlash: (path: string) => string[];
95
95
  declare const splitByLineBreak: (str: string) => string[];
96
96
  declare const concatTemplateStrings: (template: TemplateStringsArray, values: any[]) => string;
97
- interface StringOrTemplateFunction {
98
- (str: string): string;
99
- (template: TemplateStringsArray, ...values: any[]): string;
100
- }
101
- interface UnindentFunction extends StringOrTemplateFunction {
102
- (trimStart?: boolean, trimEnd?: boolean): StringOrTemplateFunction;
103
- }
104
97
  /**
105
98
  * @example
106
99
  * ```ts
@@ -122,11 +115,9 @@ interface UnindentFunction extends StringOrTemplateFunction {
122
115
  * const str3 = unindent(true, false)(" hello\n world\n");
123
116
  * ```
124
117
  */
125
- declare const unindent: UnindentFunction;
126
- interface IndentFunction {
127
- (indentNumber: number, trimStart?: boolean, trimEnd?: boolean): StringOrTemplateFunction;
128
- (indentString: string, trimStart?: boolean, trimEnd?: boolean): StringOrTemplateFunction;
129
- }
118
+ declare function unindent(str: string): string;
119
+ declare function unindent(template: TemplateStringsArray, ...values: any[]): string;
120
+ declare function unindent(trimStart?: boolean, trimEnd?: boolean): TemplateFn<string> & ((str: string) => string);
130
121
  /**
131
122
  * @example
132
123
  * ```ts
@@ -148,7 +139,8 @@ interface IndentFunction {
148
139
  * const str3 = indent(2, true, false)("hello\nworld\n");
149
140
  * ```
150
141
  */
151
- declare const indent: IndentFunction;
142
+ declare function indent(indentNumber: number, trimStart?: boolean, trimEnd?: boolean): TemplateFn<string> & ((str: string) => string);
143
+ declare function indent(indentString: string, trimStart?: boolean, trimEnd?: boolean): TemplateFn<string> & ((str: string) => string);
152
144
  /**
153
145
  * @example
154
146
  * ```
package/dist/common.js CHANGED
@@ -1,3 +1,3 @@
1
- import { C as linear, D as safeParse, E as normalizeError, O as stringify, S as parseValueToBoolean, T as getErrorMessage, _ as createLock, a as concatTemplateStrings, b as sleep, c as joinWithSlash, d as split, f as splitByLineBreak, g as unindent, h as toForwardSlash, i as addSuffix, k as unsafeParse, l as removePrefix, m as template, n as throttle, o as indent, p as splitWithSlash, r as addPrefix, s as join, t as debounce, u as removeSuffix, v as createPromiseWithResolvers, w as scale, x as parseKeyValuePairs, y as createSingleton } from "./chunks/chunk-5ed3bc8a.js";
1
+ import { C as linear, D as safeParse, E as normalizeError, O as stringify, S as parseValueToBoolean, T as getErrorMessage, _ as createLock, a as concatTemplateStrings, b as sleep, c as joinWithSlash, d as split, f as splitByLineBreak, g as unindent, h as toForwardSlash, i as addSuffix, k as unsafeParse, l as removePrefix, m as template, n as throttle, o as indent, p as splitWithSlash, r as addPrefix, s as join, t as debounce, u as removeSuffix, v as createPromiseWithResolvers, w as scale, x as parseKeyValuePairs, y as createSingleton } from "./chunks/chunk-486f65b0.js";
2
2
 
3
3
  export { addPrefix, addSuffix, concatTemplateStrings, createLock, createPromiseWithResolvers, createSingleton, debounce, getErrorMessage, indent, join, joinWithSlash, linear, normalizeError, unsafeParse as parse, parseKeyValuePairs, parseValueToBoolean, removePrefix, removeSuffix, safeParse, scale, sleep, split, splitByLineBreak, splitWithSlash, stringify, template, throttle, toForwardSlash, unindent };
package/dist/fs.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  /// <reference types="node" />
2
- import { i as Result } from "./chunks/chunk-d1860346.js";
2
+ import { i as Result } from "./chunks/chunk-704a1835.js";
3
3
  import * as nativeFs$1 from "fs";
4
4
 
5
5
  //#region node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.3/node_modules/fdir/dist/index.d.mts
6
-
7
6
  type FSLike = {
8
7
  readdir: typeof nativeFs$1.readdir;
9
8
  readdirSync: typeof nativeFs$1.readdirSync;
@@ -15,7 +14,6 @@ type FSLike = {
15
14
  //#endregion
16
15
  //#region node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.d.mts
17
16
  //#region src/utils.d.ts
18
-
19
17
  /**
20
18
  * Converts a path to a pattern depending on the platform.
21
19
  * Identical to {@link escapePath} on POSIX systems.
@@ -41,8 +39,7 @@ declare const escapePath: (path: string) => string;
41
39
  */
42
40
  declare function isDynamicPattern(pattern: string, options?: {
43
41
  caseSensitiveMatch: boolean;
44
- }): boolean;
45
- //#endregion
42
+ }): boolean; //#endregion
46
43
  //#region src/index.d.ts
47
44
  interface GlobOptions$1 {
48
45
  /**