@oscarpalmer/atoms 0.204.1 → 0.206.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/reverse.mjs +2 -1
- package/dist/array/select.d.mts +95 -84
- package/dist/array/select.mjs +6 -6
- package/dist/array/single.d.mts +3 -3
- package/dist/array/sort.d.mts +6 -6
- package/dist/array/sort.mjs +3 -2
- 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/alpha.mjs +1 -1
- package/dist/color/misc/get.mjs +1 -1
- package/dist/color/misc/state.d.mts +2 -29
- package/dist/color/models.d.mts +18 -4
- package/dist/color/space/hsl.mjs +7 -2
- package/dist/color/space/hwb.mjs +2 -1
- package/dist/color/space/rgb.mjs +22 -13
- 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/function/retry.mjs +12 -14
- package/dist/index.d.mts +1104 -1127
- package/dist/index.mjs +385 -383
- 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/insert.mjs +2 -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/limit.mjs +9 -9
- package/dist/internal/function/work.d.mts +4 -4
- package/dist/internal/herald.d.mts +1 -1
- package/dist/internal/math/aggregate.d.mts +43 -2
- package/dist/internal/math/aggregate.mjs +4 -1
- package/dist/internal/math/misc.d.mts +8 -0
- package/dist/internal/math/misc.mjs +11 -1
- package/dist/internal/random.mjs +2 -1
- package/dist/internal/result/attempt.d.mts +59 -0
- package/dist/internal/result/attempt.mjs +24 -0
- package/dist/internal/result/misc.d.mts +6 -6
- package/dist/internal/sized/map.d.mts +2 -2
- package/dist/internal/string/misc.mjs +4 -5
- package/dist/internal/value/compare.d.mts +7 -19
- package/dist/internal/value/equal.d.mts +8 -31
- package/dist/internal/value/equal.mjs +2 -1
- package/dist/internal/value/handlers.d.mts +2 -5
- package/dist/internal/value/has.d.mts +3 -3
- package/dist/internal/value/misc.mjs +1 -1
- package/dist/is.d.mts +4 -4
- package/dist/math.d.mts +3 -52
- package/dist/math.mjs +3 -16
- package/dist/promise/constants.d.mts +0 -1
- package/dist/promise/constants.mjs +1 -2
- package/dist/promise/helpers.d.mts +2 -2
- package/dist/promise/helpers.mjs +1 -1
- package/dist/promise/index.d.mts +7 -7
- package/dist/promise/index.mjs +9 -9
- package/dist/promise/misc.mjs +1 -1
- 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/queue.mjs +11 -6
- package/dist/result/index.d.mts +2 -59
- package/dist/result/index.mjs +1 -21
- package/dist/result/match.d.mts +3 -3
- package/dist/result/work/flow.d.mts +1 -1
- package/dist/result/work/flow.mjs +2 -1
- package/dist/result/work/pipe.d.mts +1 -1
- package/dist/result/work/pipe.mjs +2 -1
- package/dist/sized/set.d.mts +1 -1
- package/dist/string/fuzzy.d.mts +4 -4
- package/dist/string/fuzzy.mjs +7 -5
- package/dist/string/index.mjs +2 -1
- 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/clone.mjs +5 -8
- package/dist/value/diff.d.mts +1 -1
- package/dist/value/diff.mjs +3 -2
- 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
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/clone.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { isArrayOrPlainObject, isTypedArray } from "../internal/is.mjs";
|
|
2
|
+
import { unwrap } from "../internal/result/misc.mjs";
|
|
3
|
+
import { attempt } from "../internal/result/attempt.mjs";
|
|
2
4
|
import { createValueHandler } from "../internal/value/handlers.mjs";
|
|
3
5
|
//#region src/value/clone.ts
|
|
4
6
|
const CLONE_NAME = "clone";
|
|
@@ -154,14 +156,9 @@ function registerCloner(constructor, handler) {
|
|
|
154
156
|
}
|
|
155
157
|
function tryStructuredClone(value, parameters, depth) {
|
|
156
158
|
if (depth >= CLONE_MAX_DEPTH) return value;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return cloned;
|
|
161
|
-
} catch {
|
|
162
|
-
parameters.references.set(value, value);
|
|
163
|
-
return value;
|
|
164
|
-
}
|
|
159
|
+
const cloned = unwrap(attempt(() => structuredClone(value)), value);
|
|
160
|
+
parameters.references.set(value, cloned);
|
|
161
|
+
return cloned;
|
|
165
162
|
}
|
|
166
163
|
const CLONE_COPY_OPTIONS = {
|
|
167
164
|
copyFunctions: true,
|
package/dist/value/diff.d.mts
CHANGED
package/dist/value/diff.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isArrayOrPlainObject } from "../internal/is.mjs";
|
|
2
|
+
import { max, min } from "../internal/math/aggregate.mjs";
|
|
2
3
|
import { join } from "../internal/string/misc.mjs";
|
|
3
4
|
import { equal } from "../internal/value/equal.mjs";
|
|
4
5
|
//#region src/value/diff.ts
|
|
@@ -70,8 +71,8 @@ function getChanges(changes, first, second, options, prefix) {
|
|
|
70
71
|
function getDiffs(first, second, options, prefix) {
|
|
71
72
|
const changes = [];
|
|
72
73
|
if (Array.isArray(first) && Array.isArray(second)) {
|
|
73
|
-
const maximumLength =
|
|
74
|
-
const minimumLength =
|
|
74
|
+
const maximumLength = max([first.length, second.length]);
|
|
75
|
+
const minimumLength = min([first.length, second.length]);
|
|
75
76
|
for (let index = minimumLength; index < maximumLength; index += 1) {
|
|
76
77
|
const key = join([prefix, index], ".");
|
|
77
78
|
changes.push({
|
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.206.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';
|