@oscarpalmer/atoms 0.204.0 → 0.205.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.
- package/dist/array/filter.d.mts +1 -1
- package/dist/array/find.d.mts +3 -3
- package/dist/array/first.d.mts +3 -4
- package/dist/array/first.mjs +1 -1
- package/dist/array/group-by.d.mts +3 -3
- package/dist/array/index.d.mts +2 -5
- package/dist/array/index.mjs +2 -5
- package/dist/array/last.d.mts +3 -4
- package/dist/array/last.mjs +1 -1
- package/dist/array/move.d.mts +4 -4
- package/dist/array/push.d.mts +2 -1
- package/dist/array/push.mjs +1 -1
- package/dist/array/select.d.mts +95 -84
- package/dist/array/select.mjs +6 -6
- package/dist/array/sort.d.mts +6 -6
- package/dist/array/swap.d.mts +3 -3
- package/dist/array/swap.mjs +1 -1
- package/dist/array/to-map.d.mts +3 -3
- package/dist/array/to-record.d.mts +3 -3
- package/dist/beacon.mjs +2 -2
- package/dist/color/constants.d.mts +14 -41
- package/dist/color/instance.d.mts +0 -1
- package/dist/color/misc/state.d.mts +2 -29
- package/dist/color/models.d.mts +18 -4
- package/dist/function/limit.d.mts +4 -4
- package/dist/function/once.d.mts +6 -8
- package/dist/function/retry.d.mts +2 -2
- package/dist/index.d.mts +1011 -1020
- package/dist/index.mjs +113 -102
- package/dist/internal/array/compact.d.mts +1 -1
- package/dist/internal/array/find.d.mts +4 -4
- package/dist/internal/array/index-of.d.mts +3 -3
- package/dist/internal/array/insert.d.mts +1 -1
- package/dist/internal/array/match.d.mts +1 -1
- package/dist/internal/array/sets.d.mts +1 -1
- package/dist/internal/function/assert.d.mts +7 -7
- package/dist/internal/function/limit.d.mts +1 -1
- package/dist/internal/function/work.d.mts +4 -4
- package/dist/internal/herald.d.mts +1 -1
- package/dist/internal/math/aggregate.d.mts +2 -2
- package/dist/internal/result/misc.d.mts +6 -6
- package/dist/internal/sized/map.d.mts +2 -2
- package/dist/internal/value/compare.d.mts +7 -19
- package/dist/internal/value/equal.d.mts +8 -31
- package/dist/internal/value/handlers.d.mts +2 -5
- package/dist/internal/value/has.d.mts +3 -3
- package/dist/is.d.mts +6 -6
- package/dist/is.mjs +2 -2
- package/dist/promise/helpers.d.mts +2 -2
- package/dist/promise/index.d.mts +7 -7
- package/dist/promise/models.d.mts +1 -1
- package/dist/promise/timed.d.mts +1 -1
- package/dist/queue.d.mts +1 -1
- package/dist/result/index.d.mts +1 -1
- package/dist/result/index.mjs +3 -1
- package/dist/result/match.d.mts +3 -3
- package/dist/result/work/flow.d.mts +1 -1
- package/dist/result/work/pipe.d.mts +1 -1
- package/dist/sized/set.d.mts +1 -1
- package/dist/string/fuzzy.d.mts +4 -4
- package/dist/string/normalize.d.mts +1 -1
- package/dist/string/template.d.mts +1 -2
- package/dist/value/clone.d.mts +8 -20
- package/dist/value/diff.d.mts +1 -1
- package/dist/value/freeze.d.mts +4 -4
- package/dist/value/merge.d.mts +5 -5
- package/dist/value/transform.d.mts +1 -1
- package/package.json +25 -10
- package/plugin/index.js +1 -1
|
@@ -38,9 +38,6 @@ export declare function hasValue<Data extends PlainObject, Path extends NestedKe
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
export declare function hasValue<Data extends PlainObject>(data: Data, path: string, ignoreCase?: boolean): boolean;
|
|
41
|
-
export declare namespace hasValue {
|
|
42
|
-
var get: typeof hasValueResult;
|
|
43
|
-
}
|
|
44
41
|
/**
|
|
45
42
|
* Check if a property is defined in an object, and get its value if it is
|
|
46
43
|
*
|
|
@@ -83,4 +80,7 @@ export declare function hasValueResult<Data extends PlainObject, Path extends Ne
|
|
|
83
80
|
* ```
|
|
84
81
|
*/
|
|
85
82
|
export declare function hasValueResult<Data extends PlainObject>(data: Data, path: string, ignoreCase?: boolean): Result<unknown, string>;
|
|
83
|
+
export declare namespace hasValue {
|
|
84
|
+
export var get: typeof hasValueResult;
|
|
85
|
+
}
|
|
86
86
|
//#endregion
|
package/dist/is.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTypedArray } from "./internal/is.mjs";
|
|
1
|
+
import { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTemplateStringsArray, isTypedArray } from "./internal/is.mjs";
|
|
2
2
|
//#region src/is.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Is the value empty, or only containing `null` or `undefined` values?
|
|
@@ -27,14 +27,14 @@ export declare function isNonNullable<Value>(value: Value): value is Exclude<Val
|
|
|
27
27
|
* @param value Value to check
|
|
28
28
|
* @returns `true` if the value is not `undefined`, `null`, or matches an empty string, otherwise `false`
|
|
29
29
|
*/
|
|
30
|
-
export declare function isNonNullableOrEmpty<Value>(value: Value): value is Exclude<Value, undefined | null |
|
|
30
|
+
export declare function isNonNullableOrEmpty<Value>(value: Value): value is Exclude<Value, undefined | null | "">;
|
|
31
31
|
/**
|
|
32
32
|
* Is the value not `undefined`, `null`, or stringified as a whitespace-only string?
|
|
33
33
|
*
|
|
34
34
|
* @param value Value to check
|
|
35
35
|
* @returns `true` if the value is not `undefined`, `null`, or matches a whitespace-only string, otherwise `false`
|
|
36
36
|
*/
|
|
37
|
-
export declare function isNonNullableOrWhitespace<Value>(value: Value): value is Exclude<Value, undefined | null |
|
|
37
|
+
export declare function isNonNullableOrWhitespace<Value>(value: Value): value is Exclude<Value, undefined | null | "">;
|
|
38
38
|
/**
|
|
39
39
|
* Is the value not a number or a number-like string?
|
|
40
40
|
*
|
|
@@ -62,14 +62,14 @@ export declare function isNullable(value: unknown): value is undefined | null;
|
|
|
62
62
|
* @param value Value to check
|
|
63
63
|
* @returns `true` if the value is nullable or matches an empty string, otherwise `false`
|
|
64
64
|
*/
|
|
65
|
-
export declare function isNullableOrEmpty(value: unknown): value is undefined | null |
|
|
65
|
+
export declare function isNullableOrEmpty(value: unknown): value is undefined | null | "";
|
|
66
66
|
/**
|
|
67
67
|
* Is the value `undefined`, `null`, or stringified as a whitespace-only string?
|
|
68
68
|
*
|
|
69
69
|
* @param value Value to check
|
|
70
70
|
* @returns `true` if the value is nullable or matches a whitespace-only string, otherwise `false`
|
|
71
71
|
*/
|
|
72
|
-
export declare function isNullableOrWhitespace(value: unknown): value is undefined | null |
|
|
72
|
+
export declare function isNullableOrWhitespace(value: unknown): value is undefined | null | "";
|
|
73
73
|
/**
|
|
74
74
|
* Is the value a number or a number-like string?
|
|
75
75
|
*
|
|
@@ -85,4 +85,4 @@ export declare function isNumerical(value: unknown): value is number | `${number
|
|
|
85
85
|
*/
|
|
86
86
|
export declare function isObject(value: unknown): value is object;
|
|
87
87
|
//#endregion
|
|
88
|
-
export { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTypedArray };
|
|
88
|
+
export { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTemplateStringsArray, isTypedArray };
|
package/dist/is.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTypedArray } from "./internal/is.mjs";
|
|
1
|
+
import { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTemplateStringsArray, isTypedArray } from "./internal/is.mjs";
|
|
2
2
|
import { getArray } from "./internal/array/get.mjs";
|
|
3
3
|
import { getString } from "./internal/string/misc.mjs";
|
|
4
4
|
//#region src/is.ts
|
|
@@ -120,4 +120,4 @@ function isObject(value) {
|
|
|
120
120
|
}
|
|
121
121
|
const EXPRESSION_WHITESPACE = /^\s*$/;
|
|
122
122
|
//#endregion
|
|
123
|
-
export { isArrayOrPlainObject, isConstructor, isEmpty, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isPlainObject, isPrimitive, isTypedArray };
|
|
123
|
+
export { isArrayOrPlainObject, isConstructor, isEmpty, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isPlainObject, isPrimitive, isTemplateStringsArray, isTypedArray };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RequiredKeys } from "../models.mjs";
|
|
2
2
|
import { FulfilledPromise, PromiseOptions, PromiseStrategy, PromisesOptions, PromisesValue, RejectedPromise } from "./models.mjs";
|
|
3
3
|
//#region src/promise/helpers.d.ts
|
|
4
|
-
export declare function createPromiseOptions(input: unknown): RequiredKeys<PromiseOptions,
|
|
5
|
-
export declare function createPromisesOptions(input: unknown): RequiredKeys<PromisesOptions,
|
|
4
|
+
export declare function createPromiseOptions(input: unknown): RequiredKeys<PromiseOptions, "time">;
|
|
5
|
+
export declare function createPromisesOptions(input: unknown): RequiredKeys<PromisesOptions, "strategy">;
|
|
6
6
|
export declare function getResultsFromPromises(promised: Array<PromisesValue<unknown>> | Record<string, PromisesValue<unknown>>): unknown;
|
|
7
7
|
export declare function getStrategyOrDefault(value: unknown): PromiseStrategy;
|
|
8
8
|
/**
|
package/dist/promise/index.d.mts
CHANGED
|
@@ -34,7 +34,7 @@ export declare function attemptPromise<Value>(callback: () => Value, options?: P
|
|
|
34
34
|
* @param options Options for handling the _Promises_
|
|
35
35
|
* @returns List of results
|
|
36
36
|
*/
|
|
37
|
-
export declare function promises<Items extends unknown[], Options extends PromisesOptions>(items: [...Items], options?: Options): Promise<Options[
|
|
37
|
+
export declare function promises<Items extends unknown[], Options extends PromisesOptions>(items: [...Items], options?: Options): Promise<Options["strategy"] extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
38
38
|
/**
|
|
39
39
|
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
40
40
|
*
|
|
@@ -44,7 +44,7 @@ export declare function promises<Items extends unknown[], Options extends Promis
|
|
|
44
44
|
* @param options Options for handling the _Promises_
|
|
45
45
|
* @returns Keyed object of results
|
|
46
46
|
*/
|
|
47
|
-
export declare function promises<Items extends PlainObject, Options extends PromisesOptions>(items: Items, options?: Options): Promise<Options[
|
|
47
|
+
export declare function promises<Items extends PlainObject, Options extends PromisesOptions>(items: Items, options?: Options): Promise<Options["strategy"] extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
48
48
|
/**
|
|
49
49
|
* Handle a list of _Promises_, returning their results in an ordered array
|
|
50
50
|
*
|
|
@@ -54,7 +54,7 @@ export declare function promises<Items extends PlainObject, Options extends Prom
|
|
|
54
54
|
* @param strategy Strategy for handling the _Promises_
|
|
55
55
|
* @returns List of results
|
|
56
56
|
*/
|
|
57
|
-
export declare function promises<Items extends unknown[], Strategy extends PromiseStrategy>(items: [...Items], strategy: Strategy): Promise<Strategy extends
|
|
57
|
+
export declare function promises<Items extends unknown[], Strategy extends PromiseStrategy>(items: [...Items], strategy: Strategy): Promise<Strategy extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
58
58
|
/**
|
|
59
59
|
* Handle keyed _Promises_, returning their results in a similarly keyed object
|
|
60
60
|
*
|
|
@@ -64,7 +64,7 @@ export declare function promises<Items extends unknown[], Strategy extends Promi
|
|
|
64
64
|
* @param strategy Strategy for handling the _Promises_
|
|
65
65
|
* @returns Keyed object of results
|
|
66
66
|
*/
|
|
67
|
-
export declare function promises<Items extends PlainObject, Strategy extends PromiseStrategy>(items: Items, strategy: Strategy): Promise<Strategy extends
|
|
67
|
+
export declare function promises<Items extends PlainObject, Strategy extends PromiseStrategy>(items: Items, strategy: Strategy): Promise<Strategy extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
|
|
68
68
|
/**
|
|
69
69
|
* Handle a list of _Promises_, returning their results in an ordered array
|
|
70
70
|
*
|
|
@@ -81,9 +81,6 @@ export declare function promises<Items extends unknown[]>(items: [...Items], sig
|
|
|
81
81
|
* @returns Keyed object of results
|
|
82
82
|
*/
|
|
83
83
|
export declare function promises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesValues<PromisesItems<Items>>>;
|
|
84
|
-
export declare namespace promises {
|
|
85
|
-
var result: typeof resultPromises;
|
|
86
|
-
}
|
|
87
84
|
/**
|
|
88
85
|
* Handle a list of _Promises_, returning their results in an ordered array of results _({@link Result})_
|
|
89
86
|
*
|
|
@@ -106,4 +103,7 @@ export declare function resultPromises<Items extends unknown[]>(items: [...Items
|
|
|
106
103
|
* @returns Keyed object of results
|
|
107
104
|
*/
|
|
108
105
|
export declare function resultPromises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesResult<PromisesItems<Items>>>;
|
|
106
|
+
export declare namespace promises {
|
|
107
|
+
export var result: typeof resultPromises;
|
|
108
|
+
}
|
|
109
109
|
//#endregion
|
|
@@ -65,7 +65,7 @@ export type PromiseParameters = {
|
|
|
65
65
|
* - `complete`: wait for all _Promises_ to settle, then return the results, as an array of fulfilled and/or rejected results
|
|
66
66
|
* - `first`: rejects on the first rejected _Promise_, and returns an array of values
|
|
67
67
|
*/
|
|
68
|
-
export type PromiseStrategy =
|
|
68
|
+
export type PromiseStrategy = "complete" | "first";
|
|
69
69
|
/**
|
|
70
70
|
* An error thrown when a promise times out
|
|
71
71
|
*/
|
package/dist/promise/timed.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function getTimedPromise<Value>(promise: Promise<Value>, time: nu
|
|
|
9
9
|
* @param options Timed options
|
|
10
10
|
* @returns Timed _Promise_
|
|
11
11
|
*/
|
|
12
|
-
export declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions,
|
|
12
|
+
export declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions, "time">): Promise<Value>;
|
|
13
13
|
/**
|
|
14
14
|
* Create a _Promise_ that should be settled within a certain amount of time
|
|
15
15
|
*
|
package/dist/queue.d.mts
CHANGED
|
@@ -248,6 +248,6 @@ export declare function queue<Callback extends GenericAsyncCallback>(callback: C
|
|
|
248
248
|
*/
|
|
249
249
|
export declare function queue<Callback extends GenericCallback>(callback: Callback, options?: QueueOptions): Queue<Callback, Parameters<Callback>>;
|
|
250
250
|
export declare namespace queue {
|
|
251
|
-
var keyed: typeof keyedQueue;
|
|
251
|
+
export var keyed: typeof keyedQueue;
|
|
252
252
|
}
|
|
253
253
|
//#endregion
|
package/dist/result/index.d.mts
CHANGED
|
@@ -54,6 +54,6 @@ export declare function attempt<Value, E>(callback: () => Value, error: E): Exte
|
|
|
54
54
|
*/
|
|
55
55
|
export declare function attempt<Value>(callback: () => Value): Result<Value, Error>;
|
|
56
56
|
export declare namespace attempt {
|
|
57
|
-
var async: typeof asyncAttempt;
|
|
57
|
+
export var async: typeof asyncAttempt;
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
package/dist/result/index.mjs
CHANGED
|
@@ -2,7 +2,9 @@ import { getError, ok } from "../internal/result/misc.mjs";
|
|
|
2
2
|
//#region src/result/index.ts
|
|
3
3
|
async function asyncAttempt(value, err) {
|
|
4
4
|
try {
|
|
5
|
-
let result
|
|
5
|
+
let result;
|
|
6
|
+
if (typeof value === "function") result = value();
|
|
7
|
+
else result = value;
|
|
6
8
|
if (result instanceof Promise) result = await result;
|
|
7
9
|
return ok(result);
|
|
8
10
|
} catch (thrown) {
|
package/dist/result/match.d.mts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function asyncMatchResult<Value, Returned, E = Error>(result: Any
|
|
|
20
20
|
* @param error Error callback
|
|
21
21
|
* @returns Matched value-_Promise_
|
|
22
22
|
*/
|
|
23
|
-
export declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), ok: ResultMatch<Value, Returned, E>[
|
|
23
|
+
export declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), ok: ResultMatch<Value, Returned, E>["ok"], error: ResultMatch<Value, Returned, E>["error"]): Promise<Returned>;
|
|
24
24
|
/**
|
|
25
25
|
* Handles a _Result_ with match callbacks
|
|
26
26
|
*
|
|
@@ -37,8 +37,8 @@ export declare function matchResult<Value, Returned, E = Error>(result: AnyResul
|
|
|
37
37
|
* @param error Error callback
|
|
38
38
|
* @returns Matched value
|
|
39
39
|
*/
|
|
40
|
-
export declare function matchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | (() => AnyResult<Value, E>), ok: ResultMatch<Value, Returned, E>[
|
|
40
|
+
export declare function matchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | (() => AnyResult<Value, E>), ok: ResultMatch<Value, Returned, E>["ok"], error: ResultMatch<Value, Returned, E>["error"]): Returned;
|
|
41
41
|
export declare namespace matchResult {
|
|
42
|
-
var async: typeof asyncMatchResult;
|
|
42
|
+
export var async: typeof asyncMatchResult;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
@@ -178,6 +178,6 @@ export declare function attemptFlow<First extends GenericCallback>(first: First,
|
|
|
178
178
|
*/
|
|
179
179
|
export declare function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown>;
|
|
180
180
|
export declare namespace attemptFlow {
|
|
181
|
-
var async: typeof attemptAsyncFlow;
|
|
181
|
+
export var async: typeof attemptAsyncFlow;
|
|
182
182
|
}
|
|
183
183
|
//#endregion
|
|
@@ -179,6 +179,6 @@ export declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth
|
|
|
179
179
|
*/
|
|
180
180
|
export declare function attemptPipe<Initial>(initial: GenericCallback | Initial | Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): WrapValue<Initial>;
|
|
181
181
|
export declare namespace attemptPipe {
|
|
182
|
-
var async: typeof attemptAsyncPipe;
|
|
182
|
+
export var async: typeof attemptAsyncPipe;
|
|
183
183
|
}
|
|
184
184
|
//#endregion
|
package/dist/sized/set.d.mts
CHANGED
|
@@ -36,7 +36,7 @@ export declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
36
36
|
/**
|
|
37
37
|
* @inheritdoc
|
|
38
38
|
*/
|
|
39
|
-
add(value: Value): this;
|
|
39
|
+
override add(value: Value): this;
|
|
40
40
|
/**
|
|
41
41
|
* Get a value from the _SizedSet_, if it exists _(and optionally move it to the end)_
|
|
42
42
|
*
|
package/dist/string/fuzzy.d.mts
CHANGED
|
@@ -109,10 +109,6 @@ export declare function fuzzy<Item>(items: Item[], handler?: (item: Item) => str
|
|
|
109
109
|
* @returns Fuzzy searcher
|
|
110
110
|
*/
|
|
111
111
|
export declare function fuzzy<Item>(items: Item[], configuration?: FuzzyConfiguration<Item>): Fuzzy<Item>;
|
|
112
|
-
export declare namespace fuzzy {
|
|
113
|
-
var is: typeof isFuzzy;
|
|
114
|
-
var match: typeof fuzzyMatch;
|
|
115
|
-
}
|
|
116
112
|
/**
|
|
117
113
|
* Does the needle match the haystack in a fuzzy way?
|
|
118
114
|
*
|
|
@@ -132,4 +128,8 @@ export declare function fuzzyMatch(haystack: string, needle: string): boolean;
|
|
|
132
128
|
* @returns `true` if the value is a fuzzy searcher, otherwise `false`
|
|
133
129
|
*/
|
|
134
130
|
export declare function isFuzzy<Item = unknown>(value: unknown): value is Fuzzy<Item>;
|
|
131
|
+
export declare namespace fuzzy {
|
|
132
|
+
export var is: typeof isFuzzy;
|
|
133
|
+
export var match: typeof fuzzyMatch;
|
|
134
|
+
}
|
|
135
135
|
//#endregion
|
|
@@ -65,6 +65,6 @@ export declare function initializeNormalizer(options?: NormalizeOptions): Normal
|
|
|
65
65
|
*/
|
|
66
66
|
export declare function normalize(value: string, options?: NormalizeOptions): string;
|
|
67
67
|
export declare namespace normalize {
|
|
68
|
-
var initialize: typeof initializeNormalizer;
|
|
68
|
+
export var initialize: typeof initializeNormalizer;
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
@@ -41,7 +41,6 @@ type Templater = {
|
|
|
41
41
|
* Render a template string with variables
|
|
42
42
|
*/
|
|
43
43
|
type TemplaterRenderer = (variables?: PlainObject) => string;
|
|
44
|
-
declare function Templater(this: any, options: Required<TemplateOptions>): void;
|
|
45
44
|
/**
|
|
46
45
|
* Create a _Templater_ with predefined options
|
|
47
46
|
*
|
|
@@ -67,6 +66,6 @@ export declare function template(strings: TemplateStringsArray, ...values: unkno
|
|
|
67
66
|
*/
|
|
68
67
|
export declare function template(value: string, variables?: PlainObject, options?: Partial<TemplateOptions>): string;
|
|
69
68
|
export declare namespace template {
|
|
70
|
-
var initialize: typeof initializeTemplater;
|
|
69
|
+
export var initialize: typeof initializeTemplater;
|
|
71
70
|
}
|
|
72
71
|
//#endregion
|
package/dist/value/clone.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Constructor
|
|
1
|
+
import { Constructor } from "../models.mjs";
|
|
2
|
+
import { ValueHandler } from "../internal/value/handlers.mjs";
|
|
2
3
|
//#region src/value/clone.d.ts
|
|
3
4
|
export type CloneOptions = {
|
|
4
5
|
/**
|
|
@@ -47,25 +48,6 @@ export type Cloner = {
|
|
|
47
48
|
* @returns Cloned value
|
|
48
49
|
*/
|
|
49
50
|
export declare function clone<Value>(value: Value, options?: CloneOptions): Value;
|
|
50
|
-
export declare namespace clone {
|
|
51
|
-
var deregister: typeof deregisterCloner;
|
|
52
|
-
var handlers: {
|
|
53
|
-
base: {
|
|
54
|
-
handlers: WeakMap<WeakKey, string | GenericCallback>;
|
|
55
|
-
options: {
|
|
56
|
-
callback: GenericCallback;
|
|
57
|
-
method?: string;
|
|
58
|
-
};
|
|
59
|
-
owner: GenericCallback;
|
|
60
|
-
deregister: (constructor: Constructor) => void;
|
|
61
|
-
get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
|
|
62
|
-
register: (constructor: Constructor, handler?: string | GenericCallback) => void;
|
|
63
|
-
};
|
|
64
|
-
handle(value: unknown, ...parameters: unknown[]): unknown;
|
|
65
|
-
};
|
|
66
|
-
var initialize: typeof initializeCloner;
|
|
67
|
-
var register: typeof registerCloner;
|
|
68
|
-
}
|
|
69
51
|
/**
|
|
70
52
|
* Copy any kind of value
|
|
71
53
|
*
|
|
@@ -102,4 +84,10 @@ export declare function initializeCloner(options?: CloneOptions): Cloner;
|
|
|
102
84
|
* @param handler Method name or clone function _(defaults to method name `clone`)_
|
|
103
85
|
*/
|
|
104
86
|
export declare function registerCloner<Instance>(constructor: Constructor<Instance>, handler?: string | ((value: Instance) => Instance)): void;
|
|
87
|
+
export declare namespace clone {
|
|
88
|
+
export var deregister: typeof deregisterCloner;
|
|
89
|
+
export var handlers: ValueHandler;
|
|
90
|
+
export var initialize: typeof initializeCloner;
|
|
91
|
+
export var register: typeof registerCloner;
|
|
92
|
+
}
|
|
105
93
|
//#endregion
|
package/dist/value/diff.d.mts
CHANGED
package/dist/value/freeze.d.mts
CHANGED
|
@@ -128,10 +128,6 @@ export declare function freeze<Item>(set: Set<Item>): Frozen<Set<Item>>;
|
|
|
128
128
|
* @returns Frozen value
|
|
129
129
|
*/
|
|
130
130
|
export declare function freeze<Value>(value: Value): Value;
|
|
131
|
-
export declare namespace freeze {
|
|
132
|
-
var flat: typeof flatFreeze;
|
|
133
|
-
var is: typeof isFrozen;
|
|
134
|
-
}
|
|
135
131
|
/**
|
|
136
132
|
* Is the value frozen?
|
|
137
133
|
*
|
|
@@ -141,4 +137,8 @@ export declare namespace freeze {
|
|
|
141
137
|
* @returns `true` if the value is frozen, otherwise `false`
|
|
142
138
|
*/
|
|
143
139
|
export declare function isFrozen(value: unknown): boolean;
|
|
140
|
+
export declare namespace freeze {
|
|
141
|
+
export var flat: typeof flatFreeze;
|
|
142
|
+
export var is: typeof isFrozen;
|
|
143
|
+
}
|
|
144
144
|
//#endregion
|
package/dist/value/merge.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { ArrayOrPlainObject, NestedPartial, PlainObject, UnionToIntersection } f
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for assigning values
|
|
5
5
|
*/
|
|
6
|
-
export type AssignOptions = Omit<MergeOptions,
|
|
6
|
+
export type AssignOptions = Omit<MergeOptions, "assignValues">;
|
|
7
7
|
/**
|
|
8
8
|
* An assigner function for assigning values from one or more objects to the first one
|
|
9
9
|
*/
|
|
@@ -71,9 +71,6 @@ export type Merger = {
|
|
|
71
71
|
* @returns Assigned value
|
|
72
72
|
*/
|
|
73
73
|
export declare function assign<To extends PlainObject, From extends PlainObject[]>(to: To, from: [...From], options?: AssignOptions): To & UnionToIntersection<From[number]>;
|
|
74
|
-
export declare namespace assign {
|
|
75
|
-
var initialize: typeof initializeAssigner;
|
|
76
|
-
}
|
|
77
74
|
/**
|
|
78
75
|
* Create an assigner with predefined options
|
|
79
76
|
*
|
|
@@ -100,7 +97,10 @@ export declare function initializeMerger(options?: MergeOptions): Merger;
|
|
|
100
97
|
* @returns Merged value
|
|
101
98
|
*/
|
|
102
99
|
export declare function merge<Values extends ArrayOrPlainObject[]>(values: [...Values], options?: MergeOptions): UnionToIntersection<Values[number]>;
|
|
100
|
+
export declare namespace assign {
|
|
101
|
+
export var initialize: typeof initializeAssigner;
|
|
102
|
+
}
|
|
103
103
|
export declare namespace merge {
|
|
104
|
-
var initialize: typeof initializeMerger;
|
|
104
|
+
export var initialize: typeof initializeMerger;
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
@@ -55,6 +55,6 @@ export declare function transform<Value extends PlainObject, Key extends keyof V
|
|
|
55
55
|
*/
|
|
56
56
|
export declare function transform<Value extends PlainObject>(value: Value, transformers: TransformCallbacks<Value>): Value;
|
|
57
57
|
export declare namespace transform {
|
|
58
|
-
var initialize: typeof initializeTransformer;
|
|
58
|
+
export var initialize: typeof initializeTransformer;
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oscarpalmer/atoms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.205.0",
|
|
4
4
|
"description": "Atomic utilities for making your JavaScript better.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"types": "./dist/array/filter.d.mts",
|
|
47
47
|
"default": "./dist/array/filter.mjs"
|
|
48
48
|
},
|
|
49
|
+
"./array/find": {
|
|
50
|
+
"types": "./dist/array/find.d.mts",
|
|
51
|
+
"default": "./dist/array/find.mjs"
|
|
52
|
+
},
|
|
49
53
|
"./array/first": {
|
|
50
54
|
"types": "./dist/array/first.d.mts",
|
|
51
55
|
"default": "./dist/array/first.mjs"
|
|
@@ -54,6 +58,10 @@
|
|
|
54
58
|
"types": "./dist/array/group-by.d.mts",
|
|
55
59
|
"default": "./dist/array/group-by.mjs"
|
|
56
60
|
},
|
|
61
|
+
"./array/index-of": {
|
|
62
|
+
"types": "./dist/internal/array/index-of.d.mts",
|
|
63
|
+
"default": "./dist/internal/array/index-of.mjs"
|
|
64
|
+
},
|
|
57
65
|
"./array/last": {
|
|
58
66
|
"types": "./dist/array/last.d.mts",
|
|
59
67
|
"default": "./dist/array/last.mjs"
|
|
@@ -62,6 +70,10 @@
|
|
|
62
70
|
"types": "./dist/array/move.d.mts",
|
|
63
71
|
"default": "./dist/array/move.mjs"
|
|
64
72
|
},
|
|
73
|
+
"./array/select": {
|
|
74
|
+
"types": "./dist/array/select.d.mts",
|
|
75
|
+
"default": "./dist/array/select.mjs"
|
|
76
|
+
},
|
|
65
77
|
"./array/sort": {
|
|
66
78
|
"types": "./dist/array/sort.d.mts",
|
|
67
79
|
"default": "./dist/array/sort.mjs"
|
|
@@ -278,16 +290,19 @@
|
|
|
278
290
|
"watch": "npx vite build --watch"
|
|
279
291
|
},
|
|
280
292
|
"devDependencies": {
|
|
281
|
-
"@
|
|
282
|
-
"@
|
|
283
|
-
"
|
|
284
|
-
"
|
|
285
|
-
"jsdom": "^30",
|
|
293
|
+
"@types/node": "^26.6",
|
|
294
|
+
"@vitest/coverage-istanbul": "5.0.1",
|
|
295
|
+
"eslint": "^10.11",
|
|
296
|
+
"jsdom": "^30.1",
|
|
286
297
|
"tsdown": "^0.23",
|
|
287
|
-
"typescript": "^
|
|
288
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@
|
|
289
|
-
"vite-plus": "
|
|
290
|
-
"vitest": "
|
|
298
|
+
"typescript": "^7",
|
|
299
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
|
|
300
|
+
"vite-plus": "1.0.0",
|
|
301
|
+
"vitest": "5.0.1"
|
|
302
|
+
},
|
|
303
|
+
"overrides": {
|
|
304
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
|
|
305
|
+
"vitest": "5.0.1"
|
|
291
306
|
},
|
|
292
307
|
"packageManager": "npm@11.11.1"
|
|
293
308
|
}
|
package/plugin/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {eslintCompatPlugin} from '
|
|
1
|
+
import {eslintCompatPlugin} from 'vite-plus/lint/plugins';
|
|
2
2
|
import {groupBy} from '../dist/array/group-by.mjs';
|
|
3
3
|
import pkg from '../package.json' with {type: 'json'};
|
|
4
4
|
import getStringPlugin from './get-string.js';
|