@oscarpalmer/atoms 0.108.0 → 0.109.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/atoms.full.js +1 -1
- package/package.json +4 -102
- package/src/array/unique.ts +4 -5
- package/src/internal/math/aggregate.ts +2 -2
- package/src/internal/string.ts +1 -1
- package/types/array/unique.d.ts +3 -4
- package/types/internal/math/aggregate.d.ts +1 -1
- package/types/internal/string.d.ts +1 -1
- package/dist/array/count.cjs +0 -14
- package/dist/array/exists.cjs +0 -6
- package/dist/array/filter.cjs +0 -5
- package/dist/array/find.cjs +0 -5
- package/dist/array/flatten.cjs +0 -4
- package/dist/array/get.cjs +0 -17
- package/dist/array/group-by.cjs +0 -4
- package/dist/array/index-of.cjs +0 -5
- package/dist/array/index.cjs +0 -38
- package/dist/array/insert.cjs +0 -5
- package/dist/array/models.cjs +0 -0
- package/dist/array/push.cjs +0 -5
- package/dist/array/sort.cjs +0 -47
- package/dist/array/splice.cjs +0 -5
- package/dist/array/to-map.cjs +0 -21
- package/dist/array/to-record.cjs +0 -4
- package/dist/array/to-set.cjs +0 -11
- package/dist/array/unique.cjs +0 -6
- package/dist/color/constants.cjs +0 -32
- package/dist/color/index.cjs +0 -77
- package/dist/color/is.cjs +0 -46
- package/dist/color/misc.cjs +0 -9
- package/dist/color/models.cjs +0 -0
- package/dist/color/state.cjs +0 -44
- package/dist/color/value.cjs +0 -77
- package/dist/emitter.cjs +0 -118
- package/dist/function.cjs +0 -100
- package/dist/index.cjs +0 -141
- package/dist/internal/array/callbacks.cjs +0 -15
- package/dist/internal/array/chunk.cjs +0 -15
- package/dist/internal/array/compact.cjs +0 -12
- package/dist/internal/array/find.cjs +0 -49
- package/dist/internal/array/group.cjs +0 -19
- package/dist/internal/array/insert.cjs +0 -18
- package/dist/internal/array/shuffle.cjs +0 -13
- package/dist/internal/function.cjs +0 -27
- package/dist/internal/is.cjs +0 -36
- package/dist/internal/math/aggregate.cjs +0 -39
- package/dist/internal/number.cjs +0 -33
- package/dist/internal/random.cjs +0 -13
- package/dist/internal/string.cjs +0 -38
- package/dist/internal/value/compare.cjs +0 -50
- package/dist/internal/value/equal.cjs +0 -133
- package/dist/internal/value/get.cjs +0 -13
- package/dist/internal/value/misc.cjs +0 -23
- package/dist/internal/value/set.cjs +0 -33
- package/dist/is.cjs +0 -40
- package/dist/logger.cjs +0 -59
- package/dist/math.cjs +0 -24
- package/dist/models.cjs +0 -0
- package/dist/number.cjs +0 -4
- package/dist/query.cjs +0 -61
- package/dist/random.cjs +0 -37
- package/dist/sized.cjs +0 -62
- package/dist/string/case.cjs +0 -50
- package/dist/string/index.cjs +0 -17
- package/dist/string/misc.cjs +0 -26
- package/dist/string/template.cjs +0 -17
- package/dist/touch.cjs +0 -17
- package/dist/value/clone.cjs +0 -96
- package/dist/value/diff.cjs +0 -78
- package/dist/value/index.cjs +0 -20
- package/dist/value/merge.cjs +0 -37
- package/dist/value/partial.cjs +0 -11
- package/dist/value/smush.cjs +0 -24
- package/dist/value/unsmush.cjs +0 -28
- package/types/array/count.d.cts +0 -38
- package/types/array/exists.d.cts +0 -42
- package/types/array/filter.d.cts +0 -42
- package/types/array/find.d.cts +0 -38
- package/types/array/flatten.d.cts +0 -14
- package/types/array/get.d.cts +0 -44
- package/types/array/group-by.d.cts +0 -168
- package/types/array/index-of.d.cts +0 -38
- package/types/array/index.d.cts +0 -765
- package/types/array/insert.d.cts +0 -19
- package/types/array/models.d.cts +0 -57
- package/types/array/push.d.cts +0 -11
- package/types/array/sort.d.cts +0 -87
- package/types/array/splice.d.cts +0 -36
- package/types/array/to-map.d.cts +0 -113
- package/types/array/to-record.d.cts +0 -174
- package/types/array/to-set.d.cts +0 -28
- package/types/array/unique.d.cts +0 -33
- package/types/color/constants.d.cts +0 -23
- package/types/color/index.d.cts +0 -91
- package/types/color/is.d.cts +0 -61
- package/types/color/misc.d.cts +0 -10
- package/types/color/models.d.cts +0 -20
- package/types/color/state.d.cts +0 -20
- package/types/color/value.d.cts +0 -40
- package/types/emitter.d.cts +0 -103
- package/types/function.d.cts +0 -76
- package/types/index.d.cts +0 -3342
- package/types/internal/array/callbacks.d.cts +0 -14
- package/types/internal/array/chunk.d.cts +0 -11
- package/types/internal/array/compact.d.cts +0 -16
- package/types/internal/array/find.d.cts +0 -9
- package/types/internal/array/group.d.cts +0 -9
- package/types/internal/array/insert.d.cts +0 -5
- package/types/internal/array/shuffle.d.cts +0 -10
- package/types/internal/function.d.cts +0 -12
- package/types/internal/is.d.cts +0 -50
- package/types/internal/math/aggregate.d.cts +0 -40
- package/types/internal/number.d.cts +0 -27
- package/types/internal/random.d.cts +0 -18
- package/types/internal/string.d.cts +0 -26
- package/types/internal/value/compare.d.cts +0 -11
- package/types/internal/value/equal.d.cts +0 -30
- package/types/internal/value/get.d.cts +0 -1607
- package/types/internal/value/misc.d.cts +0 -10
- package/types/internal/value/set.d.cts +0 -1258
- package/types/is.d.cts +0 -98
- package/types/logger.d.cts +0 -90
- package/types/math.d.cts +0 -101
- package/types/models.d.cts +0 -1626
- package/types/number.d.cts +0 -27
- package/types/query.d.cts +0 -20
- package/types/random.d.cts +0 -59
- package/types/sized.d.cts +0 -98
- package/types/string/case.d.cts +0 -40
- package/types/string/index.d.cts +0 -101
- package/types/string/misc.d.cts +0 -24
- package/types/string/template.d.cts +0 -26
- package/types/touch.d.cts +0 -12
- package/types/value/clone.d.cts +0 -10
- package/types/value/diff.d.cts +0 -44
- package/types/value/index.d.cts +0 -1854
- package/types/value/merge.d.cts +0 -40
- package/types/value/partial.d.cts +0 -15
- package/types/value/smush.d.cts +0 -1601
- package/types/value/unsmush.d.cts +0 -167
package/dist/atoms.full.js
CHANGED
|
@@ -438,7 +438,7 @@ const aggregators = {
|
|
|
438
438
|
|
|
439
439
|
/**
|
|
440
440
|
* Get the string value from any value
|
|
441
|
-
* @param
|
|
441
|
+
* @param value Value to get the string from
|
|
442
442
|
* @returns String representation of the value
|
|
443
443
|
*/
|
|
444
444
|
function getString(value) {
|
package/package.json
CHANGED
|
@@ -25,168 +25,72 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
"./package.json": "./package.json",
|
|
27
27
|
".": {
|
|
28
|
-
"import": {
|
|
29
28
|
"types": "./types/index.d.ts",
|
|
30
29
|
"default": "./dist/index.js"
|
|
31
|
-
},
|
|
32
|
-
"require": {
|
|
33
|
-
"types": "./types/index.d.cts",
|
|
34
|
-
"default": "./dist/index.cjs"
|
|
35
|
-
}
|
|
36
30
|
},
|
|
37
31
|
"./array": {
|
|
38
|
-
"import": {
|
|
39
32
|
"types": "./types/array/index.d.ts",
|
|
40
33
|
"default": "./dist/array/index.js"
|
|
41
|
-
},
|
|
42
|
-
"require": {
|
|
43
|
-
"types": "./types/array/index.d.cts",
|
|
44
|
-
"default": "./dist/array/index.cjs"
|
|
45
|
-
}
|
|
46
34
|
},
|
|
47
35
|
"./color": {
|
|
48
|
-
"import": {
|
|
49
36
|
"types": "./types/color/index.d.ts",
|
|
50
37
|
"default": "./dist/color/index.js"
|
|
51
|
-
},
|
|
52
|
-
"require": {
|
|
53
|
-
"types": "./types/color/index.d.cts",
|
|
54
|
-
"default": "./dist/color/index.cjs"
|
|
55
|
-
}
|
|
56
38
|
},
|
|
57
39
|
"./emitter": {
|
|
58
|
-
"import": {
|
|
59
40
|
"types": "./types/emitter.d.ts",
|
|
60
41
|
"default": "./dist/emitter.js"
|
|
61
|
-
},
|
|
62
|
-
"require": {
|
|
63
|
-
"types": "./types/emitter.d.cts",
|
|
64
|
-
"default": "./dist/emitter.cjs"
|
|
65
|
-
}
|
|
66
42
|
},
|
|
67
43
|
"./function": {
|
|
68
|
-
"import": {
|
|
69
44
|
"types": "./types/function.d.ts",
|
|
70
45
|
"default": "./dist/function.js"
|
|
71
|
-
},
|
|
72
|
-
"require": {
|
|
73
|
-
"types": "./types/function.d.cts",
|
|
74
|
-
"default": "./dist/function.cjs"
|
|
75
|
-
}
|
|
76
46
|
},
|
|
77
47
|
"./is": {
|
|
78
|
-
"import": {
|
|
79
48
|
"types": "./types/is.d.ts",
|
|
80
49
|
"default": "./dist/is.js"
|
|
81
|
-
},
|
|
82
|
-
"require": {
|
|
83
|
-
"types": "./types/is.d.cts",
|
|
84
|
-
"default": "./dist/is.cjs"
|
|
85
|
-
}
|
|
86
50
|
},
|
|
87
51
|
"./logger": {
|
|
88
|
-
"import": {
|
|
89
52
|
"types": "./types/logger.d.ts",
|
|
90
53
|
"default": "./dist/logger.js"
|
|
91
|
-
},
|
|
92
|
-
"require": {
|
|
93
|
-
"types": "./types/logger.d.cts",
|
|
94
|
-
"default": "./dist/logger.cjs"
|
|
95
|
-
}
|
|
96
54
|
},
|
|
97
55
|
"./math": {
|
|
98
|
-
"import": {
|
|
99
56
|
"types": "./types/math.d.ts",
|
|
100
57
|
"default": "./dist/math.js"
|
|
101
|
-
},
|
|
102
|
-
"require": {
|
|
103
|
-
"types": "./types/math.d.cts",
|
|
104
|
-
"default": "./dist/math.cjs"
|
|
105
|
-
}
|
|
106
58
|
},
|
|
107
59
|
"./models": {
|
|
108
|
-
"import": {
|
|
109
60
|
"types": "./types/models.d.ts"
|
|
110
|
-
},
|
|
111
|
-
"require": {
|
|
112
|
-
"types": "./types/models.d.cts"
|
|
113
|
-
}
|
|
114
61
|
},
|
|
115
62
|
"./number": {
|
|
116
|
-
"import": {
|
|
117
63
|
"types": "./types/number.d.ts",
|
|
118
64
|
"default": "./dist/number.js"
|
|
119
|
-
},
|
|
120
|
-
"require": {
|
|
121
|
-
"types": "./types/number.d.cts",
|
|
122
|
-
"default": "./dist/number.cjs"
|
|
123
|
-
}
|
|
124
65
|
},
|
|
125
66
|
"./query": {
|
|
126
|
-
"import": {
|
|
127
67
|
"types": "./types/query.d.ts",
|
|
128
68
|
"default": "./dist/query.js"
|
|
129
|
-
},
|
|
130
|
-
"require": {
|
|
131
|
-
"types": "./types/query.d.cts",
|
|
132
|
-
"default": "./dist/query.cjs"
|
|
133
|
-
}
|
|
134
69
|
},
|
|
135
70
|
"./random": {
|
|
136
|
-
"import": {
|
|
137
71
|
"types": "./types/random.d.ts",
|
|
138
72
|
"default": "./dist/random.js"
|
|
139
|
-
},
|
|
140
|
-
"require": {
|
|
141
|
-
"types": "./types/random.d.cts",
|
|
142
|
-
"default": "./dist/random.cjs"
|
|
143
|
-
}
|
|
144
73
|
},
|
|
145
74
|
"./sized": {
|
|
146
|
-
"import": {
|
|
147
75
|
"types": "./types/sized.d.ts",
|
|
148
76
|
"default": "./dist/sized.js"
|
|
149
|
-
},
|
|
150
|
-
"require": {
|
|
151
|
-
"types": "./types/sized.d.cts",
|
|
152
|
-
"default": "./dist/sized.cjs"
|
|
153
|
-
}
|
|
154
77
|
},
|
|
155
78
|
"./string": {
|
|
156
|
-
"import": {
|
|
157
79
|
"types": "./types/string/index.d.ts",
|
|
158
80
|
"default": "./dist/string/index.js"
|
|
159
|
-
},
|
|
160
|
-
"require": {
|
|
161
|
-
"types": "./types/string/index.d.cts",
|
|
162
|
-
"default": "./dist/string/index.cjs"
|
|
163
|
-
}
|
|
164
81
|
},
|
|
165
82
|
"./supports-touch": {
|
|
166
|
-
"import": {
|
|
167
83
|
"types": "./types/touch.d.ts",
|
|
168
84
|
"default": "./dist/touch.js"
|
|
169
|
-
},
|
|
170
|
-
"require": {
|
|
171
|
-
"types": "./types/touch.d.cts",
|
|
172
|
-
"default": "./dist/touch.cjs"
|
|
173
|
-
}
|
|
174
85
|
},
|
|
175
86
|
"./value": {
|
|
176
|
-
"import": {
|
|
177
87
|
"types": "./types/value/index.d.ts",
|
|
178
88
|
"default": "./dist/value/index.js"
|
|
179
|
-
},
|
|
180
|
-
"require": {
|
|
181
|
-
"types": "./types/value/index.d.cts",
|
|
182
|
-
"default": "./dist/value/index.cjs"
|
|
183
|
-
}
|
|
184
89
|
}
|
|
185
90
|
},
|
|
186
91
|
"files": ["dist", "src", "types"],
|
|
187
92
|
"keywords": ["helper", "utility"],
|
|
188
93
|
"license": "MIT",
|
|
189
|
-
"main": "./dist/index.cjs",
|
|
190
94
|
"module": "./dist/index.js",
|
|
191
95
|
"name": "@oscarpalmer/atoms",
|
|
192
96
|
"repository": {
|
|
@@ -194,15 +98,13 @@
|
|
|
194
98
|
"url": "git+https://github.com/oscarpalmer/atoms.git"
|
|
195
99
|
},
|
|
196
100
|
"scripts": {
|
|
197
|
-
"build": "npm run clean && npx vite build && npm run rollup:build &&
|
|
101
|
+
"build": "npm run clean && npx vite build && npm run rollup:build && npx tsc",
|
|
198
102
|
"clean": "rm -rf ./dist && rm -rf ./types && rm -f ./tsconfig.tsbuildinfo",
|
|
199
103
|
"rollup:build": "npx rollup -c",
|
|
200
104
|
"rollup:watch": "npx rollup -c --watch",
|
|
201
|
-
"test": "npx vitest --coverage"
|
|
202
|
-
"types": "npx tsc && npx dts-bundle-generator --config ./dts.config.cts --silent",
|
|
203
|
-
"watch": "npx vite build --watch"
|
|
105
|
+
"test": "npx vitest --coverage"
|
|
204
106
|
},
|
|
205
107
|
"type": "module",
|
|
206
|
-
"types": "./types/index.d.
|
|
207
|
-
"version": "0.
|
|
108
|
+
"types": "./types/index.d.ts",
|
|
109
|
+
"version": "0.109.0"
|
|
208
110
|
}
|
package/src/array/unique.ts
CHANGED
|
@@ -11,7 +11,7 @@ export function unique<Item>(array: Item[]): Item[];
|
|
|
11
11
|
/**
|
|
12
12
|
* Get an array of unique items
|
|
13
13
|
* @param array Array to get unique items from
|
|
14
|
-
* @param key Key to use for
|
|
14
|
+
* @param key Key to use for value
|
|
15
15
|
* @returns Array of unique items
|
|
16
16
|
*/
|
|
17
17
|
export function unique<Item extends PlainObject, ItemKey extends keyof Item>(
|
|
@@ -22,14 +22,13 @@ export function unique<Item extends PlainObject, ItemKey extends keyof Item>(
|
|
|
22
22
|
/**
|
|
23
23
|
* Get an array of unique items
|
|
24
24
|
* @param array Array to get unique items from
|
|
25
|
-
* @param
|
|
26
|
-
* @param value Value to use for comparison
|
|
25
|
+
* @param callback Function to get a value from each item
|
|
27
26
|
* @returns Array of unique items
|
|
28
27
|
*/
|
|
29
28
|
export function unique<
|
|
30
29
|
Item,
|
|
31
|
-
|
|
32
|
-
>(array: Item[],
|
|
30
|
+
ItemCallback extends (item: Item, index: number, array: Item[]) => Key,
|
|
31
|
+
>(array: Item[], callback: ItemCallback): Item[];
|
|
33
32
|
|
|
34
33
|
export function unique(array: unknown[], key?: unknown): unknown[] {
|
|
35
34
|
if (!Array.isArray(array)) {
|
|
@@ -87,8 +87,8 @@ export function max<Item extends PlainObject>(
|
|
|
87
87
|
* @returns Maximum value, or `NaN` if no maximum can be found
|
|
88
88
|
*/
|
|
89
89
|
export function max<Item extends PlainObject>(
|
|
90
|
-
|
|
91
|
-
callback: (item: Item, index: number,
|
|
90
|
+
array: Item[],
|
|
91
|
+
callback: (item: Item, index: number, array: Item[]) => number,
|
|
92
92
|
): number;
|
|
93
93
|
|
|
94
94
|
export function max(array: unknown[], key?: unknown): number {
|
package/src/internal/string.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {compact} from './array/compact';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the string value from any value
|
|
5
|
-
* @param
|
|
5
|
+
* @param value Value to get the string from
|
|
6
6
|
* @returns String representation of the value
|
|
7
7
|
*/
|
|
8
8
|
export function getString(value: unknown): string {
|
package/types/array/unique.d.ts
CHANGED
|
@@ -8,15 +8,14 @@ export declare function unique<Item>(array: Item[]): Item[];
|
|
|
8
8
|
/**
|
|
9
9
|
* Get an array of unique items
|
|
10
10
|
* @param array Array to get unique items from
|
|
11
|
-
* @param key Key to use for
|
|
11
|
+
* @param key Key to use for value
|
|
12
12
|
* @returns Array of unique items
|
|
13
13
|
*/
|
|
14
14
|
export declare function unique<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Item[];
|
|
15
15
|
/**
|
|
16
16
|
* Get an array of unique items
|
|
17
17
|
* @param array Array to get unique items from
|
|
18
|
-
* @param
|
|
19
|
-
* @param value Value to use for comparison
|
|
18
|
+
* @param callback Function to get a value from each item
|
|
20
19
|
* @returns Array of unique items
|
|
21
20
|
*/
|
|
22
|
-
export declare function unique<Item,
|
|
21
|
+
export declare function unique<Item, ItemCallback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: ItemCallback): Item[];
|
|
@@ -30,5 +30,5 @@ export declare function max<Item extends PlainObject>(array: Item[], key: keyof
|
|
|
30
30
|
* @param callback Function to get a value in object to get the maximum from
|
|
31
31
|
* @returns Maximum value, or `NaN` if no maximum can be found
|
|
32
32
|
*/
|
|
33
|
-
export declare function max<Item extends PlainObject>(
|
|
33
|
+
export declare function max<Item extends PlainObject>(array: Item[], callback: (item: Item, index: number, array: Item[]) => number): number;
|
|
34
34
|
export {};
|
package/dist/array/count.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const require_internal_array_find = require("../internal/array/find.cjs");
|
|
2
|
-
function count(array, ...parameters) {
|
|
3
|
-
if (Array.isArray(parameters) && parameters.length === 1 && typeof parameters[0] !== "function") {
|
|
4
|
-
if (!Array.isArray(array)) return NaN;
|
|
5
|
-
const { length } = array;
|
|
6
|
-
if (length === 0) return 0;
|
|
7
|
-
const value = parameters[0];
|
|
8
|
-
let result = 0;
|
|
9
|
-
for (let index = 0; index < length; index += 1) result += Object.is(array[index], value) ? 1 : 0;
|
|
10
|
-
return result;
|
|
11
|
-
}
|
|
12
|
-
return require_internal_array_find.findValues("all", array, parameters, true)?.length ?? NaN;
|
|
13
|
-
}
|
|
14
|
-
exports.count = count;
|
package/dist/array/exists.cjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const require_internal_array_find = require("../internal/array/find.cjs");
|
|
2
|
-
function exists(array, ...parameters) {
|
|
3
|
-
if (parameters.length === 1 && typeof parameters[0] !== "function") return Array.isArray(array) ? array.includes(parameters[0]) : false;
|
|
4
|
-
return require_internal_array_find.findValue("index", array, parameters) > -1;
|
|
5
|
-
}
|
|
6
|
-
exports.exists = exists;
|
package/dist/array/filter.cjs
DELETED
package/dist/array/find.cjs
DELETED
package/dist/array/flatten.cjs
DELETED
package/dist/array/get.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const require_internal_is = require("../internal/is.cjs");
|
|
2
|
-
function getArray(value, indiced) {
|
|
3
|
-
if (Array.isArray(value)) return value;
|
|
4
|
-
if (require_internal_is.isPlainObject(value)) {
|
|
5
|
-
if (indiced !== true) return Object.values(value);
|
|
6
|
-
const keys = Object.keys(value);
|
|
7
|
-
const { length } = keys;
|
|
8
|
-
const array = [];
|
|
9
|
-
for (let index = 0; index < length; index += 1) {
|
|
10
|
-
const key = keys[index];
|
|
11
|
-
if (!Number.isNaN(Number(key))) array.push(value[key]);
|
|
12
|
-
}
|
|
13
|
-
return array;
|
|
14
|
-
}
|
|
15
|
-
return [value];
|
|
16
|
-
}
|
|
17
|
-
exports.getArray = getArray;
|
package/dist/array/group-by.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const require_internal_array_group = require("../internal/array/group.cjs");
|
|
2
|
-
var groupBy = ((array, first, second) => require_internal_array_group.groupValues(array, first, second, false));
|
|
3
|
-
groupBy.arrays = ((array, first, second) => require_internal_array_group.groupValues(array, first, second, true));
|
|
4
|
-
exports.groupBy = groupBy;
|
package/dist/array/index-of.cjs
DELETED
package/dist/array/index.cjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const require_internal_array_shuffle = require("../internal/array/shuffle.cjs");
|
|
2
|
-
const require_internal_array_compact = require("../internal/array/compact.cjs");
|
|
3
|
-
const require_internal_array_chunk = require("../internal/array/chunk.cjs");
|
|
4
|
-
const require_array_count = require("./count.cjs");
|
|
5
|
-
const require_array_exists = require("./exists.cjs");
|
|
6
|
-
const require_array_filter = require("./filter.cjs");
|
|
7
|
-
const require_array_find = require("./find.cjs");
|
|
8
|
-
const require_array_flatten = require("./flatten.cjs");
|
|
9
|
-
const require_array_get = require("./get.cjs");
|
|
10
|
-
const require_array_group_by = require("./group-by.cjs");
|
|
11
|
-
const require_array_index_of = require("./index-of.cjs");
|
|
12
|
-
const require_array_insert = require("./insert.cjs");
|
|
13
|
-
const require_array_push = require("./push.cjs");
|
|
14
|
-
const require_array_sort = require("./sort.cjs");
|
|
15
|
-
const require_array_splice = require("./splice.cjs");
|
|
16
|
-
const require_array_to_map = require("./to-map.cjs");
|
|
17
|
-
const require_array_to_record = require("./to-record.cjs");
|
|
18
|
-
const require_array_to_set = require("./to-set.cjs");
|
|
19
|
-
const require_array_unique = require("./unique.cjs");
|
|
20
|
-
exports.chunk = require_internal_array_chunk.chunk;
|
|
21
|
-
exports.compact = require_internal_array_compact.compact;
|
|
22
|
-
exports.count = require_array_count.count;
|
|
23
|
-
exports.exists = require_array_exists.exists;
|
|
24
|
-
exports.filter = require_array_filter.filter;
|
|
25
|
-
exports.find = require_array_find.find;
|
|
26
|
-
exports.flatten = require_array_flatten.flatten;
|
|
27
|
-
exports.getArray = require_array_get.getArray;
|
|
28
|
-
exports.groupBy = require_array_group_by.groupBy;
|
|
29
|
-
exports.indexOf = require_array_index_of.indexOf;
|
|
30
|
-
exports.insert = require_array_insert.insert;
|
|
31
|
-
exports.push = require_array_push.push;
|
|
32
|
-
exports.shuffle = require_internal_array_shuffle.shuffle;
|
|
33
|
-
exports.sort = require_array_sort.sort;
|
|
34
|
-
exports.splice = require_array_splice.splice;
|
|
35
|
-
exports.toMap = require_array_to_map.toMap;
|
|
36
|
-
exports.toRecord = require_array_to_record.toRecord;
|
|
37
|
-
exports.toSet = require_array_to_set.toSet;
|
|
38
|
-
exports.unique = require_array_unique.unique;
|
package/dist/array/insert.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const require_internal_array_insert = require("../internal/array/insert.cjs");
|
|
2
|
-
function insert(array, indexOrItems, items) {
|
|
3
|
-
return require_internal_array_insert.insertValues("insert", array, items == null ? indexOrItems : items, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
|
|
4
|
-
}
|
|
5
|
-
exports.insert = insert;
|
package/dist/array/models.cjs
DELETED
|
File without changes
|
package/dist/array/push.cjs
DELETED
package/dist/array/sort.cjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const require_internal_is = require("../internal/is.cjs");
|
|
2
|
-
require("../is.cjs");
|
|
3
|
-
const require_internal_value_compare = require("../internal/value/compare.cjs");
|
|
4
|
-
function getSorter(value, modifier) {
|
|
5
|
-
const isObject = require_internal_is.isPlainObject(value);
|
|
6
|
-
const sorter = {
|
|
7
|
-
identifier: "",
|
|
8
|
-
modifier
|
|
9
|
-
};
|
|
10
|
-
sorter.compare = isObject && typeof value.compare === "function" ? value.compare : void 0;
|
|
11
|
-
sorter.key = isObject && typeof value.key === "string" ? value.key : typeof value === "string" ? value : void 0;
|
|
12
|
-
sorter.callback = sorter.key == null ? isObject && typeof value.value === "function" ? value.value : typeof value === "function" ? value : void 0 : void 0;
|
|
13
|
-
if (isObject && typeof value.direction === "string") sorter.modifier = value.direction === "ascending" ? 1 : value.direction === "descending" ? -1 : modifier;
|
|
14
|
-
if (sorter.key != null || sorter.callback != null) {
|
|
15
|
-
sorter.identifier = `${sorter.key ?? sorter.callback}`;
|
|
16
|
-
return sorter;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function sort(array, first, second) {
|
|
20
|
-
if (!Array.isArray(array)) return [];
|
|
21
|
-
if (array.length < 2) return array;
|
|
22
|
-
const modifier = (first === true || second === true ? "desc" : "asc") === "asc" ? 1 : -1;
|
|
23
|
-
const sorters = (Array.isArray(first) ? first : [first]).map((item) => getSorter(item, modifier)).filter((sorter) => sorter != null).filter((current, index, sorters$1) => sorters$1.findIndex((next) => next.identifier === current.identifier) === index);
|
|
24
|
-
const { length } = sorters;
|
|
25
|
-
if (length === 0) return array.sort((first$1, second$1) => require_internal_value_compare.compare(first$1, second$1) * modifier);
|
|
26
|
-
if (length === 1) {
|
|
27
|
-
const sorter = sorters[0];
|
|
28
|
-
const { callback, key, modifier: modifier$1 } = sorter;
|
|
29
|
-
return array.sort((first$1, second$1) => {
|
|
30
|
-
const firstValue = key == null ? callback?.(first$1) : first$1[key];
|
|
31
|
-
const secondValue = key == null ? callback?.(second$1) : second$1[key];
|
|
32
|
-
return (sorter.compare?.(first$1, firstValue, second$1, secondValue) ?? require_internal_value_compare.compare(firstValue, secondValue)) * modifier$1;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return array.sort((first$1, second$1) => {
|
|
36
|
-
for (let index = 0; index < length; index += 1) {
|
|
37
|
-
const sorter = sorters[index];
|
|
38
|
-
const { callback, key, modifier: modifier$1 } = sorter;
|
|
39
|
-
const firstValue = key == null ? callback?.(first$1) : first$1[key];
|
|
40
|
-
const secondValue = key == null ? callback?.(second$1) : second$1[key];
|
|
41
|
-
const compared = (sorter.compare?.(first$1, firstValue, second$1, secondValue) ?? require_internal_value_compare.compare(firstValue, secondValue)) * modifier$1;
|
|
42
|
-
if (compared !== 0) return compared;
|
|
43
|
-
}
|
|
44
|
-
return 0;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
exports.sort = sort;
|
package/dist/array/splice.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const require_internal_array_insert = require("../internal/array/insert.cjs");
|
|
2
|
-
function splice(array, start, deleteCountOrItems, items) {
|
|
3
|
-
return require_internal_array_insert.insertValues("splice", array, typeof deleteCountOrItems === "number" ? items : deleteCountOrItems, start, typeof deleteCountOrItems === "number" ? deleteCountOrItems : 0);
|
|
4
|
-
}
|
|
5
|
-
exports.splice = splice;
|
package/dist/array/to-map.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const require_internal_array_callbacks = require("../internal/array/callbacks.cjs");
|
|
2
|
-
function getMapValues(array, first, second, arrays) {
|
|
3
|
-
if (!Array.isArray(array)) return /* @__PURE__ */ new Map();
|
|
4
|
-
const { length } = array;
|
|
5
|
-
const callbacks = require_internal_array_callbacks.getCallbacks(void 0, first, second);
|
|
6
|
-
const map = /* @__PURE__ */ new Map();
|
|
7
|
-
for (let index = 0; index < length; index += 1) {
|
|
8
|
-
const item = array[index];
|
|
9
|
-
const key = callbacks?.keyed?.(item, index, array) ?? index;
|
|
10
|
-
const value = callbacks?.value?.(item, index, array) ?? item;
|
|
11
|
-
if (arrays) {
|
|
12
|
-
const existing = map.get(key);
|
|
13
|
-
if (existing == null) map.set(key, [value]);
|
|
14
|
-
else existing.push(value);
|
|
15
|
-
} else map.set(key, value);
|
|
16
|
-
}
|
|
17
|
-
return map;
|
|
18
|
-
}
|
|
19
|
-
var toMap = ((array, first, second, arrays) => getMapValues(array, first, second, arrays));
|
|
20
|
-
toMap.arrays = ((array, first, second) => getMapValues(array, first, second, true));
|
|
21
|
-
exports.toMap = toMap;
|
package/dist/array/to-record.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const require_internal_array_group = require("../internal/array/group.cjs");
|
|
2
|
-
var toRecord = ((array, first, second) => require_internal_array_group.groupValues(array, first, second, false));
|
|
3
|
-
toRecord.arrays = ((array, first, second) => require_internal_array_group.groupValues(array, first, second, true));
|
|
4
|
-
exports.toRecord = toRecord;
|
package/dist/array/to-set.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const require_internal_array_callbacks = require("../internal/array/callbacks.cjs");
|
|
2
|
-
function toSet(array, value) {
|
|
3
|
-
if (!Array.isArray(array)) return /* @__PURE__ */ new Set();
|
|
4
|
-
const callbacks = require_internal_array_callbacks.getCallbacks(void 0, void 0, value);
|
|
5
|
-
if (callbacks?.value == null) return new Set(array);
|
|
6
|
-
const { length } = array;
|
|
7
|
-
const set = /* @__PURE__ */ new Set();
|
|
8
|
-
for (let index = 0; index < length; index += 1) set.add(callbacks.value(array[index], index, array));
|
|
9
|
-
return set;
|
|
10
|
-
}
|
|
11
|
-
exports.toSet = toSet;
|
package/dist/array/unique.cjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const require_internal_array_find = require("../internal/array/find.cjs");
|
|
2
|
-
function unique(array, key) {
|
|
3
|
-
if (!Array.isArray(array)) return [];
|
|
4
|
-
return array.length > 1 ? require_internal_array_find.findValues("unique", array, [key, void 0]) : array;
|
|
5
|
-
}
|
|
6
|
-
exports.unique = unique;
|
package/dist/color/constants.cjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const anyPattern = /^#?([a-f0-9]{3}){1,2}$/i;
|
|
2
|
-
const defaultHex = "000000";
|
|
3
|
-
const defaultHsl = {
|
|
4
|
-
hue: 0,
|
|
5
|
-
lightness: 0,
|
|
6
|
-
saturation: 0
|
|
7
|
-
};
|
|
8
|
-
const defaultRgb = {
|
|
9
|
-
blue: 0,
|
|
10
|
-
green: 0,
|
|
11
|
-
red: 0
|
|
12
|
-
};
|
|
13
|
-
const groupedPattern = /^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i;
|
|
14
|
-
const hslKeys = new Set([
|
|
15
|
-
"hue",
|
|
16
|
-
"lightness",
|
|
17
|
-
"saturation"
|
|
18
|
-
]);
|
|
19
|
-
const prefixPattern = /^#/;
|
|
20
|
-
const rgbKeys = new Set([
|
|
21
|
-
"blue",
|
|
22
|
-
"green",
|
|
23
|
-
"red"
|
|
24
|
-
]);
|
|
25
|
-
exports.anyPattern = anyPattern;
|
|
26
|
-
exports.defaultHex = defaultHex;
|
|
27
|
-
exports.defaultHsl = defaultHsl;
|
|
28
|
-
exports.defaultRgb = defaultRgb;
|
|
29
|
-
exports.groupedPattern = groupedPattern;
|
|
30
|
-
exports.hslKeys = hslKeys;
|
|
31
|
-
exports.prefixPattern = prefixPattern;
|
|
32
|
-
exports.rgbKeys = rgbKeys;
|
package/dist/color/index.cjs
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const require_color_is = require("./is.cjs");
|
|
2
|
-
const require_color_misc = require("./misc.cjs");
|
|
3
|
-
const require_color_value = require("./value.cjs");
|
|
4
|
-
const require_color_state = require("./state.cjs");
|
|
5
|
-
var Color = class {
|
|
6
|
-
#state;
|
|
7
|
-
get hex() {
|
|
8
|
-
return this.#state.hex;
|
|
9
|
-
}
|
|
10
|
-
set hex(value) {
|
|
11
|
-
if (require_color_is.isHexColor(value) && value !== this.#state.hex) {
|
|
12
|
-
const hex = require_color_misc.getNormalizedHex(value);
|
|
13
|
-
const rgb = require_color_value.hexToRgb(hex);
|
|
14
|
-
this.#state.hex = hex;
|
|
15
|
-
this.#state.hsl = require_color_value.rgbToHsl(rgb);
|
|
16
|
-
this.#state.rgb = rgb;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
get hsl() {
|
|
20
|
-
return this.#state.hsl;
|
|
21
|
-
}
|
|
22
|
-
set hsl(value) {
|
|
23
|
-
if (require_color_is.isHSLColor(value)) {
|
|
24
|
-
const rgb = require_color_value.hslToRgb(value);
|
|
25
|
-
this.#state.hex = require_color_value.rgbToHex(rgb);
|
|
26
|
-
this.#state.hsl = value;
|
|
27
|
-
this.#state.rgb = rgb;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
get rgb() {
|
|
31
|
-
return this.#state.rgb;
|
|
32
|
-
}
|
|
33
|
-
set rgb(value) {
|
|
34
|
-
if (require_color_is.isRGBColor(value)) {
|
|
35
|
-
this.#state.hex = require_color_value.rgbToHex(value);
|
|
36
|
-
this.#state.hsl = require_color_value.rgbToHsl(value);
|
|
37
|
-
this.#state.rgb = value;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
constructor(value) {
|
|
41
|
-
this.#state = require_color_state.getState(value);
|
|
42
|
-
Object.defineProperty(this, "$color", { value: true });
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
function getColor(value) {
|
|
46
|
-
return require_color_is.isColor(value) ? value : new Color(value);
|
|
47
|
-
}
|
|
48
|
-
function getForegroundColor(value) {
|
|
49
|
-
const { blue, green, red } = getColor(value).rgb;
|
|
50
|
-
const values = [
|
|
51
|
-
blue / 255,
|
|
52
|
-
green / 255,
|
|
53
|
-
red / 255
|
|
54
|
-
];
|
|
55
|
-
for (let color of values) if (color <= .03928) color /= 12.92;
|
|
56
|
-
else color = ((color + .055) / 1.055) ** 2.4;
|
|
57
|
-
const luminance = .2126 * values[2] + .7152 * values[1] + .0722 * values[0];
|
|
58
|
-
return getColor(luminance > .625 ? "000000" : "ffffff");
|
|
59
|
-
}
|
|
60
|
-
function getHexColor(value) {
|
|
61
|
-
return getColor(value).hex;
|
|
62
|
-
}
|
|
63
|
-
function getHSLColor(value) {
|
|
64
|
-
return getColor(value).hsl;
|
|
65
|
-
}
|
|
66
|
-
function getRGBColor(value) {
|
|
67
|
-
return getColor(value).rgb;
|
|
68
|
-
}
|
|
69
|
-
exports.getColor = getColor;
|
|
70
|
-
exports.getForegroundColor = getForegroundColor;
|
|
71
|
-
exports.getHSLColor = getHSLColor;
|
|
72
|
-
exports.getHexColor = getHexColor;
|
|
73
|
-
exports.getRGBColor = getRGBColor;
|
|
74
|
-
exports.isColor = require_color_is.isColor;
|
|
75
|
-
exports.isHSLColor = require_color_is.isHSLColor;
|
|
76
|
-
exports.isHexColor = require_color_is.isHexColor;
|
|
77
|
-
exports.isRGBColor = require_color_is.isRGBColor;
|