@oscarpalmer/atoms 0.124.0 → 0.125.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/group-by.js +3 -2
- package/dist/array/index.js +4 -4
- package/dist/array/to-map.js +2 -1
- package/dist/array/to-record.js +2 -1
- package/dist/atoms.full.js +11 -8
- package/dist/index.js +9 -7
- package/dist/internal/value/equal.js +3 -3
- package/dist/string/index.js +2 -2
- package/dist/string/template.js +3 -3
- package/dist/value/index.js +3 -3
- package/dist/value/merge.js +3 -3
- package/package.json +4 -4
- package/src/array/group-by.ts +12 -10
- package/src/array/index.ts +3 -3
- package/src/array/to-map.ts +12 -10
- package/src/array/to-record.ts +12 -10
- package/src/internal/value/equal.ts +2 -2
- package/src/string/index.ts +1 -1
- package/src/string/template.ts +2 -2
- package/src/value/index.ts +2 -2
- package/src/value/merge.ts +2 -2
- package/types/array/group-by.d.ts +10 -6
- package/types/array/index.d.ts +3 -3
- package/types/array/to-map.d.ts +10 -6
- package/types/array/to-record.d.ts +10 -6
- package/types/internal/value/equal.d.ts +3 -6
- package/types/string/index.d.ts +1 -1
- package/types/string/template.d.ts +3 -6
- package/types/value/index.d.ts +2 -2
- package/types/value/merge.d.ts +3 -6
package/dist/array/group-by.js
CHANGED
|
@@ -2,7 +2,8 @@ import { groupValues } from "../internal/array/group.js";
|
|
|
2
2
|
function groupBy(array, first, second) {
|
|
3
3
|
return groupValues(array, first, second, false);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
groupBy.arrays = groupArraysBy;
|
|
6
|
+
function groupArraysBy(array, first, second) {
|
|
6
7
|
return groupValues(array, first, second, true);
|
|
7
8
|
}
|
|
8
|
-
export { groupBy
|
|
9
|
+
export { groupBy };
|
package/dist/array/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { filter } from "./filter.js";
|
|
|
3
3
|
import { find } from "./find.js";
|
|
4
4
|
import { flatten } from "./flatten.js";
|
|
5
5
|
import { getArray } from "./get.js";
|
|
6
|
-
import { groupBy
|
|
6
|
+
import { groupBy } from "./group-by.js";
|
|
7
7
|
import { indexOf } from "./index-of.js";
|
|
8
8
|
import { chunk } from "../internal/array/chunk.js";
|
|
9
9
|
import { compact } from "../internal/array/compact.js";
|
|
@@ -12,8 +12,8 @@ import { insert } from "./insert.js";
|
|
|
12
12
|
import { push } from "./push.js";
|
|
13
13
|
import { sort } from "./sort.js";
|
|
14
14
|
import { splice } from "./splice.js";
|
|
15
|
-
import { toMap
|
|
16
|
-
import { toRecord
|
|
15
|
+
import { toMap } from "./to-map.js";
|
|
16
|
+
import { toRecord } from "./to-record.js";
|
|
17
17
|
import { toSet } from "./to-set.js";
|
|
18
18
|
import { unique } from "./unique.js";
|
|
19
|
-
export { chunk, compact, exists, filter, find, flatten, getArray, groupBy,
|
|
19
|
+
export { chunk, compact, exists, filter, find, flatten, getArray, groupBy, indexOf, insert, push, shuffle, sort, splice, toMap, toRecord, toSet, unique };
|
package/dist/array/to-map.js
CHANGED
|
@@ -19,7 +19,8 @@ function getMapValues(array, first, second, arrays) {
|
|
|
19
19
|
function toMap(array, first, second) {
|
|
20
20
|
return getMapValues(array, first, second, false);
|
|
21
21
|
}
|
|
22
|
+
toMap.arrays = toMapArrays;
|
|
22
23
|
function toMapArrays(array, first, second) {
|
|
23
24
|
return getMapValues(array, first, second, true);
|
|
24
25
|
}
|
|
25
|
-
export { toMap
|
|
26
|
+
export { toMap };
|
package/dist/array/to-record.js
CHANGED
|
@@ -2,7 +2,8 @@ import { groupValues } from "../internal/array/group.js";
|
|
|
2
2
|
function toRecord(array, first, second) {
|
|
3
3
|
return groupValues(array, first, second, false);
|
|
4
4
|
}
|
|
5
|
+
toRecord.arrays = toRecordArrays;
|
|
5
6
|
function toRecordArrays(array, first, second) {
|
|
6
7
|
return groupValues(array, first, second, true);
|
|
7
8
|
}
|
|
8
|
-
export { toRecord
|
|
9
|
+
export { toRecord };
|
package/dist/atoms.full.js
CHANGED
|
@@ -210,7 +210,8 @@ function groupValues(array, key, value, arrays) {
|
|
|
210
210
|
function groupBy(array, first, second) {
|
|
211
211
|
return groupValues(array, first, second, false);
|
|
212
212
|
}
|
|
213
|
-
|
|
213
|
+
groupBy.arrays = groupArraysBy;
|
|
214
|
+
function groupArraysBy(array, first, second) {
|
|
214
215
|
return groupValues(array, first, second, true);
|
|
215
216
|
}
|
|
216
217
|
function indexOf(array, ...parameters) {
|
|
@@ -443,12 +444,14 @@ function getMapValues(array, first, second, arrays) {
|
|
|
443
444
|
function toMap(array, first, second) {
|
|
444
445
|
return getMapValues(array, first, second, false);
|
|
445
446
|
}
|
|
447
|
+
toMap.arrays = toMapArrays;
|
|
446
448
|
function toMapArrays(array, first, second) {
|
|
447
449
|
return getMapValues(array, first, second, true);
|
|
448
450
|
}
|
|
449
451
|
function toRecord(array, first, second) {
|
|
450
452
|
return groupValues(array, first, second, false);
|
|
451
453
|
}
|
|
454
|
+
toRecord.arrays = toRecordArrays;
|
|
452
455
|
function toRecordArrays(array, first, second) {
|
|
453
456
|
return groupValues(array, first, second, true);
|
|
454
457
|
}
|
|
@@ -1673,12 +1676,12 @@ function template(value, variables, options) {
|
|
|
1673
1676
|
const { ignoreCase, pattern } = getTemplateOptions(options);
|
|
1674
1677
|
return handleTemplate(value, pattern, ignoreCase, variables);
|
|
1675
1678
|
}
|
|
1676
|
-
function
|
|
1679
|
+
template.initialize = function(options) {
|
|
1677
1680
|
const { ignoreCase, pattern } = getTemplateOptions(options);
|
|
1678
1681
|
return (value, variables) => {
|
|
1679
1682
|
return handleTemplate(value, pattern, ignoreCase, variables);
|
|
1680
1683
|
};
|
|
1681
|
-
}
|
|
1684
|
+
};
|
|
1682
1685
|
const EXPRESSION_VARIABLE = /{{([\s\S]+?)}}/g;
|
|
1683
1686
|
function equal(first, second, options) {
|
|
1684
1687
|
return equalValue(first, second, getEqualOptions(options));
|
|
@@ -1778,10 +1781,10 @@ function equalValue(first, second, options) {
|
|
|
1778
1781
|
default: return Object.is(first, second);
|
|
1779
1782
|
}
|
|
1780
1783
|
}
|
|
1781
|
-
function
|
|
1784
|
+
equal.initialize = function(options) {
|
|
1782
1785
|
const actual = getEqualOptions(options);
|
|
1783
1786
|
return (first, second) => equalValue(first, second, actual);
|
|
1784
|
-
}
|
|
1787
|
+
};
|
|
1785
1788
|
function filterKey(key, options) {
|
|
1786
1789
|
if (typeof key !== "string") return true;
|
|
1787
1790
|
if (options.ignoreExpressions.enabled && options.ignoreExpressions.values.some((expression) => expression.test(key))) return false;
|
|
@@ -2020,10 +2023,10 @@ function handleMerge(values, options) {
|
|
|
2020
2023
|
function merge(values, options) {
|
|
2021
2024
|
return handleMerge(values, getMergeOptions(options));
|
|
2022
2025
|
}
|
|
2023
|
-
function
|
|
2026
|
+
merge.initialize = function(options) {
|
|
2024
2027
|
const actual = getMergeOptions(options);
|
|
2025
2028
|
return (values) => handleMerge(values, actual);
|
|
2026
|
-
}
|
|
2029
|
+
};
|
|
2027
2030
|
function mergeObjects(values, options, prefix) {
|
|
2028
2031
|
const { length } = values;
|
|
2029
2032
|
const isArray = values.every(Array.isArray);
|
|
@@ -2113,4 +2116,4 @@ function unsmush(value) {
|
|
|
2113
2116
|
}
|
|
2114
2117
|
return unsmushed;
|
|
2115
2118
|
}
|
|
2116
|
-
export { frame_rate_default as FRAME_RATE_MS, SizedMap, SizedSet, average, beacon, between, camelCase, capitalize, chunk, clamp, clone, compact, compare, count, createUuid, debounce, diff, equal,
|
|
2119
|
+
export { frame_rate_default as FRAME_RATE_MS, SizedMap, SizedSet, average, beacon, between, camelCase, capitalize, chunk, clamp, clone, compact, compare, count, createUuid, debounce, diff, equal, exists, filter, find, flatten, fromQuery, getArray, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getUuid, getValue, groupBy, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, indexOf, insert, isArrayOrPlainObject, isColor, isEmpty, isHexColor, isHslColor, isHslLike, isHslaColor, isKey, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isPlainObject, isPrimitive, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, max, memoize, merge, min, noop, parse, partial, pascalCase, push, rgbToHex, rgbToHsl, rgbToHsla, round, setValue, shuffle, smush, snakeCase, sort, splice, sum, template, throttle, titleCase, toMap, toQuery, toRecord, toSet, truncate, unique, unsmush, words };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { find } from "./array/find.js";
|
|
|
4
4
|
import { flatten } from "./array/flatten.js";
|
|
5
5
|
import { isArrayOrPlainObject, isKey, isNumber, isPlainObject, isTypedArray } from "./internal/is.js";
|
|
6
6
|
import { getArray } from "./array/get.js";
|
|
7
|
-
import { groupBy
|
|
7
|
+
import { groupBy } from "./array/group-by.js";
|
|
8
8
|
import { indexOf } from "./array/index-of.js";
|
|
9
9
|
import { chunk } from "./internal/array/chunk.js";
|
|
10
10
|
import { compact } from "./internal/array/compact.js";
|
|
@@ -17,10 +17,11 @@ import { getString, join, words } from "./internal/string.js";
|
|
|
17
17
|
import { compare } from "./internal/value/compare.js";
|
|
18
18
|
import { sort } from "./array/sort.js";
|
|
19
19
|
import { splice } from "./array/splice.js";
|
|
20
|
-
import { toMap
|
|
21
|
-
import { toRecord
|
|
20
|
+
import { toMap } from "./array/to-map.js";
|
|
21
|
+
import { toRecord } from "./array/to-record.js";
|
|
22
22
|
import { toSet } from "./array/to-set.js";
|
|
23
23
|
import { unique } from "./array/unique.js";
|
|
24
|
+
import "./array/index.js";
|
|
24
25
|
import { noop } from "./internal/function.js";
|
|
25
26
|
import { beacon } from "./beacon.js";
|
|
26
27
|
import { between, clamp, getNumber } from "./internal/number.js";
|
|
@@ -42,13 +43,14 @@ import { getRandomBoolean, getRandomCharacters, getRandomColor, getRandomHex, ge
|
|
|
42
43
|
import { camelCase, capitalize, kebabCase, pascalCase, snakeCase, titleCase } from "./string/case.js";
|
|
43
44
|
import { createUuid, getUuid, parse, truncate } from "./string/misc.js";
|
|
44
45
|
import { getValue } from "./internal/value/get.js";
|
|
45
|
-
import { template
|
|
46
|
+
import { template } from "./string/template.js";
|
|
46
47
|
import "./string/index.js";
|
|
47
|
-
import { equal
|
|
48
|
+
import { equal } from "./internal/value/equal.js";
|
|
48
49
|
import { diff } from "./value/diff.js";
|
|
49
50
|
import { clone } from "./value/clone.js";
|
|
50
|
-
import { merge
|
|
51
|
+
import { merge } from "./value/merge.js";
|
|
51
52
|
import { partial } from "./value/partial.js";
|
|
52
53
|
import { smush } from "./value/smush.js";
|
|
53
54
|
import { unsmush } from "./value/unsmush.js";
|
|
54
|
-
|
|
55
|
+
import "./value/index.js";
|
|
56
|
+
export { frame_rate_default as FRAME_RATE_MS, SizedMap, SizedSet, average, beacon, between, camelCase, capitalize, chunk, clamp, clone, compact, compare, count, createUuid, debounce, diff, equal, exists, filter, find, flatten, fromQuery, getArray, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getUuid, getValue, groupBy, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, indexOf, insert, isArrayOrPlainObject, isColor, isEmpty, isHexColor, isHslColor, isHslLike, isHslaColor, isKey, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isPlainObject, isPrimitive, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, max, memoize, merge, min, noop, parse, partial, pascalCase, push, rgbToHex, rgbToHsl, rgbToHsla, round, setValue, shuffle, smush, snakeCase, sort, splice, sum, template, throttle, titleCase, toMap, toQuery, toRecord, toSet, truncate, unique, unsmush, words };
|
|
@@ -98,10 +98,10 @@ function equalValue(first, second, options) {
|
|
|
98
98
|
default: return Object.is(first, second);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
equal.initialize = function(options) {
|
|
102
102
|
const actual = getEqualOptions(options);
|
|
103
103
|
return (first, second) => equalValue(first, second, actual);
|
|
104
|
-
}
|
|
104
|
+
};
|
|
105
105
|
function filterKey(key, options) {
|
|
106
106
|
if (typeof key !== "string") return true;
|
|
107
107
|
if (options.ignoreExpressions.enabled && options.ignoreExpressions.values.some((expression) => expression.test(key))) return false;
|
|
@@ -136,4 +136,4 @@ function getEqualOptions(input) {
|
|
|
136
136
|
}
|
|
137
137
|
var ARRAY_PEEK_PERCENTAGE = 10;
|
|
138
138
|
var ARRAY_THRESHOLD = 100;
|
|
139
|
-
export { equal
|
|
139
|
+
export { equal };
|
package/dist/string/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getString, join, words } from "../internal/string.js";
|
|
2
2
|
import { camelCase, capitalize, kebabCase, pascalCase, snakeCase, titleCase } from "./case.js";
|
|
3
3
|
import { createUuid, getUuid, parse, truncate } from "./misc.js";
|
|
4
|
-
import { template
|
|
5
|
-
export { camelCase, capitalize, createUuid, getString, getUuid, join, kebabCase, parse, pascalCase, snakeCase, template,
|
|
4
|
+
import { template } from "./template.js";
|
|
5
|
+
export { camelCase, capitalize, createUuid, getString, getUuid, join, kebabCase, parse, pascalCase, snakeCase, template, titleCase, truncate, words };
|
package/dist/string/template.js
CHANGED
|
@@ -24,11 +24,11 @@ function template(value, variables, options) {
|
|
|
24
24
|
const { ignoreCase, pattern } = getTemplateOptions(options);
|
|
25
25
|
return handleTemplate(value, pattern, ignoreCase, variables);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
template.initialize = function(options) {
|
|
28
28
|
const { ignoreCase, pattern } = getTemplateOptions(options);
|
|
29
29
|
return (value, variables) => {
|
|
30
30
|
return handleTemplate(value, pattern, ignoreCase, variables);
|
|
31
31
|
};
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
var EXPRESSION_VARIABLE = /{{([\s\S]+?)}}/g;
|
|
34
|
-
export { template
|
|
34
|
+
export { template };
|
package/dist/value/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { compare } from "../internal/value/compare.js";
|
|
2
2
|
import { setValue } from "../internal/value/set.js";
|
|
3
3
|
import { getValue } from "../internal/value/get.js";
|
|
4
|
-
import { equal
|
|
4
|
+
import { equal } from "../internal/value/equal.js";
|
|
5
5
|
import { diff } from "./diff.js";
|
|
6
6
|
import { clone } from "./clone.js";
|
|
7
|
-
import { merge
|
|
7
|
+
import { merge } from "./merge.js";
|
|
8
8
|
import { partial } from "./partial.js";
|
|
9
9
|
import { smush } from "./smush.js";
|
|
10
10
|
import { unsmush } from "./unsmush.js";
|
|
11
|
-
export { clone, compare, diff, equal,
|
|
11
|
+
export { clone, compare, diff, equal, getValue, merge, partial, setValue, smush, unsmush };
|
package/dist/value/merge.js
CHANGED
|
@@ -20,10 +20,10 @@ function handleMerge(values, options) {
|
|
|
20
20
|
function merge(values, options) {
|
|
21
21
|
return handleMerge(values, getMergeOptions(options));
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
merge.initialize = function(options) {
|
|
24
24
|
const actual = getMergeOptions(options);
|
|
25
25
|
return (values) => handleMerge(values, actual);
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
function mergeObjects(values, options, prefix) {
|
|
28
28
|
const { length } = values;
|
|
29
29
|
const isArray = values.every(Array.isArray);
|
|
@@ -48,4 +48,4 @@ function mergeValues(values, options, validate, prefix) {
|
|
|
48
48
|
const actual = validate ? values.filter(isArrayOrPlainObject) : values;
|
|
49
49
|
return actual.length > 1 ? mergeObjects(actual, options, prefix) : actual[0] ?? {};
|
|
50
50
|
}
|
|
51
|
-
export { merge
|
|
51
|
+
export { merge };
|
package/package.json
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"@types/node": "^25",
|
|
9
9
|
"@vitest/coverage-istanbul": "^4",
|
|
10
10
|
"jsdom": "^27.4",
|
|
11
|
-
"oxfmt": "^0.
|
|
12
|
-
"oxlint": "^1.
|
|
13
|
-
"rolldown": "1.0.0-beta.
|
|
11
|
+
"oxfmt": "^0.23",
|
|
12
|
+
"oxlint": "^1.38",
|
|
13
|
+
"rolldown": "1.0.0-beta.58",
|
|
14
14
|
"tslib": "^2.8",
|
|
15
15
|
"typescript": "^5.9",
|
|
16
16
|
"vite": "8.0.0-beta.5",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
},
|
|
102
102
|
"type": "module",
|
|
103
103
|
"types": "./types/index.d.ts",
|
|
104
|
-
"version": "0.
|
|
104
|
+
"version": "0.125.0"
|
|
105
105
|
}
|
package/src/array/group-by.ts
CHANGED
|
@@ -114,6 +114,8 @@ export function groupBy(array: unknown[], first?: unknown, second?: unknown): un
|
|
|
114
114
|
return groupValues(array, first, second, false);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
groupBy.arrays = groupArraysBy;
|
|
118
|
+
|
|
117
119
|
/**
|
|
118
120
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
119
121
|
* @param array Array to group
|
|
@@ -121,7 +123,7 @@ export function groupBy(array: unknown[], first?: unknown, second?: unknown): un
|
|
|
121
123
|
* @param value Callback to get an item's value
|
|
122
124
|
* @returns Record of keyed values
|
|
123
125
|
*/
|
|
124
|
-
|
|
126
|
+
function groupArraysBy<
|
|
125
127
|
Item,
|
|
126
128
|
KeyCallback extends (item: Item, index: number, array: Item[]) => Key,
|
|
127
129
|
ValueCallback extends (item: Item, index: number, array: Item[]) => unknown,
|
|
@@ -138,7 +140,7 @@ export function groupByArrays<
|
|
|
138
140
|
* @param value Key to use for value
|
|
139
141
|
* @returns Record of keyed values
|
|
140
142
|
*/
|
|
141
|
-
|
|
143
|
+
function groupArraysBy<
|
|
142
144
|
Item extends PlainObject,
|
|
143
145
|
KeyCallback extends (item: Item, index: number, array: Item[]) => Key,
|
|
144
146
|
ItemValue extends keyof Item,
|
|
@@ -155,7 +157,7 @@ export function groupByArrays<
|
|
|
155
157
|
* @param value Callback to get an item's value
|
|
156
158
|
* @returns Record of keyed values
|
|
157
159
|
*/
|
|
158
|
-
|
|
160
|
+
function groupArraysBy<
|
|
159
161
|
Item extends PlainObject,
|
|
160
162
|
ItemKey extends keyof Item,
|
|
161
163
|
ValueCallback extends (item: Item, index: number, array: Item[]) => unknown,
|
|
@@ -172,7 +174,7 @@ export function groupByArrays<
|
|
|
172
174
|
* @param value Key to use for value
|
|
173
175
|
* @returns Record of keyed values
|
|
174
176
|
*/
|
|
175
|
-
|
|
177
|
+
function groupArraysBy<
|
|
176
178
|
Item extends PlainObject,
|
|
177
179
|
ItemKey extends keyof Item,
|
|
178
180
|
ItemValue extends keyof Item,
|
|
@@ -188,10 +190,10 @@ export function groupByArrays<
|
|
|
188
190
|
* @param callback Callback to get an item's grouping key
|
|
189
191
|
* @returns Record of keyed items
|
|
190
192
|
*/
|
|
191
|
-
|
|
192
|
-
Item,
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
function groupArraysBy<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(
|
|
194
|
+
array: Item[],
|
|
195
|
+
callback: Callback,
|
|
196
|
+
): Record<ReturnType<Callback>, Item[]>;
|
|
195
197
|
|
|
196
198
|
/**
|
|
197
199
|
* Create a record from an array of items using a specific key, grouping items into arrays
|
|
@@ -199,11 +201,11 @@ export function groupByArrays<
|
|
|
199
201
|
* @param key Key to use for grouping
|
|
200
202
|
* @returns Record of keyed items
|
|
201
203
|
*/
|
|
202
|
-
|
|
204
|
+
function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item>(
|
|
203
205
|
array: Item[],
|
|
204
206
|
key: ItemKey,
|
|
205
207
|
): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
|
|
206
208
|
|
|
207
|
-
|
|
209
|
+
function groupArraysBy(array: unknown[], first?: unknown, second?: unknown): unknown {
|
|
208
210
|
return groupValues(array, first, second, true);
|
|
209
211
|
}
|
package/src/array/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export {filter} from './filter';
|
|
|
6
6
|
export {find} from './find';
|
|
7
7
|
export {flatten} from './flatten';
|
|
8
8
|
export {getArray} from './get';
|
|
9
|
-
export {groupBy
|
|
9
|
+
export {groupBy} from './group-by';
|
|
10
10
|
export {indexOf} from './index-of';
|
|
11
11
|
export {insert} from './insert';
|
|
12
12
|
export type {
|
|
@@ -21,7 +21,7 @@ export type {
|
|
|
21
21
|
export {push} from './push';
|
|
22
22
|
export {sort} from './sort';
|
|
23
23
|
export {splice} from './splice';
|
|
24
|
-
export {toMap
|
|
25
|
-
export {toRecord
|
|
24
|
+
export {toMap} from './to-map';
|
|
25
|
+
export {toRecord} from './to-record';
|
|
26
26
|
export {toSet} from './to-set';
|
|
27
27
|
export {unique} from './unique';
|
package/src/array/to-map.ts
CHANGED
|
@@ -138,6 +138,8 @@ export function toMap(array: unknown[], first?: unknown, second?: unknown): unkn
|
|
|
138
138
|
return getMapValues(array, first, second, false);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
toMap.arrays = toMapArrays;
|
|
142
|
+
|
|
141
143
|
/**
|
|
142
144
|
* Create a Map from an array of items using callbacks, grouping values into arrays
|
|
143
145
|
* @param array Array to convert
|
|
@@ -145,7 +147,7 @@ export function toMap(array: unknown[], first?: unknown, second?: unknown): unkn
|
|
|
145
147
|
* @param value Callback to get an item's value
|
|
146
148
|
* @returns Map of keyed arrays of values
|
|
147
149
|
*/
|
|
148
|
-
|
|
150
|
+
function toMapArrays<
|
|
149
151
|
Item,
|
|
150
152
|
KeyCallback extends (item: Item, index: number, array: Item[]) => Key,
|
|
151
153
|
ValueCallback extends (item: Item, index: number, array: Item[]) => unknown,
|
|
@@ -162,7 +164,7 @@ export function toMapArrays<
|
|
|
162
164
|
* @param value Key to use for value
|
|
163
165
|
* @returns Map of keyed arrays of values
|
|
164
166
|
*/
|
|
165
|
-
|
|
167
|
+
function toMapArrays<
|
|
166
168
|
Item extends PlainObject,
|
|
167
169
|
KeyCallback extends (item: Item, index: number, array: Item[]) => Key,
|
|
168
170
|
ItemValue extends keyof Item,
|
|
@@ -179,7 +181,7 @@ export function toMapArrays<
|
|
|
179
181
|
* @param value Callback to get an item's value
|
|
180
182
|
* @returns Map of keyed arrays of values
|
|
181
183
|
*/
|
|
182
|
-
|
|
184
|
+
function toMapArrays<
|
|
183
185
|
Item extends PlainObject,
|
|
184
186
|
ItemKey extends keyof Item,
|
|
185
187
|
ValueCallback extends (item: Item, index: number, array: Item[]) => unknown,
|
|
@@ -196,7 +198,7 @@ export function toMapArrays<
|
|
|
196
198
|
* @param value Key to use for value
|
|
197
199
|
* @returns Map of keyed arrays of values
|
|
198
200
|
*/
|
|
199
|
-
|
|
201
|
+
function toMapArrays<
|
|
200
202
|
Item extends PlainObject,
|
|
201
203
|
ItemKey extends keyof Item,
|
|
202
204
|
ItemValue extends keyof Item,
|
|
@@ -208,10 +210,10 @@ export function toMapArrays<
|
|
|
208
210
|
* @param callback Callback to get an item's grouping key
|
|
209
211
|
* @returns Map of keyed arrays of items
|
|
210
212
|
*/
|
|
211
|
-
|
|
212
|
-
Item,
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
function toMapArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(
|
|
214
|
+
array: Item[],
|
|
215
|
+
callback: Callback,
|
|
216
|
+
): Map<ReturnType<Callback>, Item[]>;
|
|
215
217
|
|
|
216
218
|
/**
|
|
217
219
|
* Create a Map from an array of items using a key, grouping items into arrays
|
|
@@ -219,11 +221,11 @@ export function toMapArrays<
|
|
|
219
221
|
* @param key Key to use for grouping
|
|
220
222
|
* @returns Map of keyed arrays of items
|
|
221
223
|
*/
|
|
222
|
-
|
|
224
|
+
function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item>(
|
|
223
225
|
array: Item[],
|
|
224
226
|
key: ItemKey,
|
|
225
227
|
): Map<Item[ItemKey], Item[]>;
|
|
226
228
|
|
|
227
|
-
|
|
229
|
+
function toMapArrays(array: unknown[], first?: unknown, second?: unknown): unknown {
|
|
228
230
|
return getMapValues(array, first, second, true);
|
|
229
231
|
}
|
package/src/array/to-record.ts
CHANGED
|
@@ -114,6 +114,8 @@ export function toRecord(array: unknown[], first?: unknown, second?: unknown): u
|
|
|
114
114
|
return groupValues(array, first, second, false);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
toRecord.arrays = toRecordArrays;
|
|
118
|
+
|
|
117
119
|
/**
|
|
118
120
|
* Create a record from an array of items using callbacks, grouping values into arrays
|
|
119
121
|
* @param array Array to convert
|
|
@@ -121,7 +123,7 @@ export function toRecord(array: unknown[], first?: unknown, second?: unknown): u
|
|
|
121
123
|
* @param value Callback to get an item's value
|
|
122
124
|
* @returns Record of keyed arrays of values
|
|
123
125
|
*/
|
|
124
|
-
|
|
126
|
+
function toRecordArrays<
|
|
125
127
|
Item,
|
|
126
128
|
KeyCallback extends (item: Item, index: number, array: Item[]) => Key,
|
|
127
129
|
ValueCallback extends (item: Item, index: number, array: Item[]) => unknown,
|
|
@@ -138,7 +140,7 @@ export function toRecordArrays<
|
|
|
138
140
|
* @param value Key to use for value
|
|
139
141
|
* @returns Record of keyed arrays of values
|
|
140
142
|
*/
|
|
141
|
-
|
|
143
|
+
function toRecordArrays<
|
|
142
144
|
Item extends PlainObject,
|
|
143
145
|
Callback extends (item: Item, index: number, array: Item[]) => Key,
|
|
144
146
|
ItemValue extends keyof Item,
|
|
@@ -155,7 +157,7 @@ export function toRecordArrays<
|
|
|
155
157
|
* @param callback Callback to get an item's value
|
|
156
158
|
* @returns Record of keyed arrays of values
|
|
157
159
|
*/
|
|
158
|
-
|
|
160
|
+
function toRecordArrays<
|
|
159
161
|
Item extends PlainObject,
|
|
160
162
|
ItemKey extends keyof Item,
|
|
161
163
|
Callback extends (item: Item, index: number, array: Item[]) => unknown,
|
|
@@ -172,7 +174,7 @@ export function toRecordArrays<
|
|
|
172
174
|
* @param value Key to use for value
|
|
173
175
|
* @returns Record of keyed arrays of values
|
|
174
176
|
*/
|
|
175
|
-
|
|
177
|
+
function toRecordArrays<
|
|
176
178
|
Item extends PlainObject,
|
|
177
179
|
ItemKey extends keyof Item,
|
|
178
180
|
ItemValue extends keyof Item,
|
|
@@ -188,10 +190,10 @@ export function toRecordArrays<
|
|
|
188
190
|
* @param callback Callback to get an item's grouping key
|
|
189
191
|
* @returns Record of keyed arrays of items
|
|
190
192
|
*/
|
|
191
|
-
|
|
192
|
-
Item,
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
function toRecordArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(
|
|
194
|
+
array: Item[],
|
|
195
|
+
callback: Callback,
|
|
196
|
+
): Record<ReturnType<Callback>, Item[]>;
|
|
195
197
|
|
|
196
198
|
/**
|
|
197
199
|
* Create a record from an array of items using a key, grouping items into arrays
|
|
@@ -199,11 +201,11 @@ export function toRecordArrays<
|
|
|
199
201
|
* @param key Key to use for grouping
|
|
200
202
|
* @returns Record of keyed arrays of items
|
|
201
203
|
*/
|
|
202
|
-
|
|
204
|
+
function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item>(
|
|
203
205
|
array: Item[],
|
|
204
206
|
key: ItemKey,
|
|
205
207
|
): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
|
|
206
208
|
|
|
207
|
-
|
|
209
|
+
function toRecordArrays(array: unknown[], first?: unknown, second?: unknown): unknown {
|
|
208
210
|
return groupValues(array, first, second, true);
|
|
209
211
|
}
|
|
@@ -296,11 +296,11 @@ function equalValue(first: unknown, second: unknown, options: Options): boolean
|
|
|
296
296
|
* @param options Comparison options
|
|
297
297
|
* @returns Equalizer function
|
|
298
298
|
*/
|
|
299
|
-
|
|
299
|
+
equal.initialize = function (options?: EqualOptions): Equalizer {
|
|
300
300
|
const actual = getEqualOptions(options);
|
|
301
301
|
|
|
302
302
|
return (first: unknown, second: unknown): boolean => equalValue(first, second, actual);
|
|
303
|
-
}
|
|
303
|
+
};
|
|
304
304
|
|
|
305
305
|
function filterKey(key: string | symbol, options: Options): boolean {
|
|
306
306
|
if (typeof key !== 'string') {
|
package/src/string/index.ts
CHANGED
|
@@ -2,4 +2,4 @@ export {getString, join, words} from '../internal/string';
|
|
|
2
2
|
export type {PlainObject} from '../models';
|
|
3
3
|
export {camelCase, capitalize, kebabCase, pascalCase, snakeCase, titleCase} from './case';
|
|
4
4
|
export {createUuid, getUuid, parse, truncate} from './misc';
|
|
5
|
-
export {template
|
|
5
|
+
export {template} from './template';
|
package/src/string/template.ts
CHANGED
|
@@ -82,13 +82,13 @@ export function template(
|
|
|
82
82
|
* @param options Templating options
|
|
83
83
|
* @returns Templater function
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
template.initialize = function (options?: Partial<TemplateOptions>): Templater {
|
|
86
86
|
const {ignoreCase, pattern} = getTemplateOptions(options);
|
|
87
87
|
|
|
88
88
|
return (value: string, variables?: PlainObject): string => {
|
|
89
89
|
return handleTemplate(value, pattern, ignoreCase, variables);
|
|
90
90
|
};
|
|
91
|
-
}
|
|
91
|
+
};
|
|
92
92
|
|
|
93
93
|
//
|
|
94
94
|
|
package/src/value/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export {compare} from '../internal/value/compare';
|
|
2
2
|
export {diff} from './diff';
|
|
3
|
-
export {equal
|
|
3
|
+
export {equal} from '../internal/value/equal';
|
|
4
4
|
export {getValue} from '../internal/value/get';
|
|
5
5
|
export {setValue} from '../internal/value/set';
|
|
6
6
|
export type {ArrayOrPlainObject, NestedPartial, PlainObject} from '../models';
|
|
7
7
|
export {clone} from './clone';
|
|
8
|
-
export {merge
|
|
8
|
+
export {merge} from './merge';
|
|
9
9
|
export {partial} from './partial';
|
|
10
10
|
export {smush} from './smush';
|
|
11
11
|
export {unsmush} from './unsmush';
|
package/src/value/merge.ts
CHANGED
|
@@ -88,12 +88,12 @@ export function merge<Model extends ArrayOrPlainObject>(
|
|
|
88
88
|
* @param options Merging options
|
|
89
89
|
* @returns Merger function
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
merge.initialize = function (options?: Partial<MergeOptions>): Merger {
|
|
92
92
|
const actual = getMergeOptions(options);
|
|
93
93
|
|
|
94
94
|
return <Model extends ArrayOrPlainObject>(values: NestedPartial<Model>[]): Model =>
|
|
95
95
|
handleMerge(values, actual) as Model;
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
|
|
98
98
|
function mergeObjects(
|
|
99
99
|
values: ArrayOrPlainObject[],
|
|
@@ -63,6 +63,9 @@ export declare function groupBy<Item extends PlainObject, ItemKey extends keyof
|
|
|
63
63
|
* @returns Record of indiced items
|
|
64
64
|
*/
|
|
65
65
|
export declare function groupBy<Item>(array: Item[]): Record<number, Item>;
|
|
66
|
+
export declare namespace groupBy {
|
|
67
|
+
var arrays: typeof groupArraysBy;
|
|
68
|
+
}
|
|
66
69
|
/**
|
|
67
70
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
68
71
|
* @param array Array to group
|
|
@@ -70,7 +73,7 @@ export declare function groupBy<Item>(array: Item[]): Record<number, Item>;
|
|
|
70
73
|
* @param value Callback to get an item's value
|
|
71
74
|
* @returns Record of keyed values
|
|
72
75
|
*/
|
|
73
|
-
|
|
76
|
+
declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
|
|
74
77
|
/**
|
|
75
78
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
76
79
|
* @param array Array to group
|
|
@@ -78,7 +81,7 @@ export declare function groupByArrays<Item, KeyCallback extends (item: Item, ind
|
|
|
78
81
|
* @param value Key to use for value
|
|
79
82
|
* @returns Record of keyed values
|
|
80
83
|
*/
|
|
81
|
-
|
|
84
|
+
declare function groupArraysBy<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Record<ReturnType<KeyCallback>, Item[ItemValue][]>;
|
|
82
85
|
/**
|
|
83
86
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
84
87
|
* @param array Array to group
|
|
@@ -86,7 +89,7 @@ export declare function groupByArrays<Item extends PlainObject, KeyCallback exte
|
|
|
86
89
|
* @param value Callback to get an item's value
|
|
87
90
|
* @returns Record of keyed values
|
|
88
91
|
*/
|
|
89
|
-
|
|
92
|
+
declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<ValueCallback>[]>>;
|
|
90
93
|
/**
|
|
91
94
|
* Create a record from an array of items using a specific key and value, grouping values into arrays
|
|
92
95
|
* @param array Array to group
|
|
@@ -94,18 +97,19 @@ export declare function groupByArrays<Item extends PlainObject, ItemKey extends
|
|
|
94
97
|
* @param value Key to use for value
|
|
95
98
|
* @returns Record of keyed values
|
|
96
99
|
*/
|
|
97
|
-
|
|
100
|
+
declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item, ItemValue extends keyof Item>(array: Item[], key: ItemKey, value: ItemValue): Simplify<Record<KeyedValue<Item, ItemKey>, Item[ItemValue][]>>;
|
|
98
101
|
/**
|
|
99
102
|
* Create a record from an array of items using a specific key, grouping items into arrays
|
|
100
103
|
* @param array Array to group
|
|
101
104
|
* @param callback Callback to get an item's grouping key
|
|
102
105
|
* @returns Record of keyed items
|
|
103
106
|
*/
|
|
104
|
-
|
|
107
|
+
declare function groupArraysBy<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item[]>;
|
|
105
108
|
/**
|
|
106
109
|
* Create a record from an array of items using a specific key, grouping items into arrays
|
|
107
110
|
* @param array Array to group
|
|
108
111
|
* @param key Key to use for grouping
|
|
109
112
|
* @returns Record of keyed items
|
|
110
113
|
*/
|
|
111
|
-
|
|
114
|
+
declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
|
|
115
|
+
export {};
|
package/types/array/index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export { filter } from './filter';
|
|
|
6
6
|
export { find } from './find';
|
|
7
7
|
export { flatten } from './flatten';
|
|
8
8
|
export { getArray } from './get';
|
|
9
|
-
export { groupBy
|
|
9
|
+
export { groupBy } from './group-by';
|
|
10
10
|
export { indexOf } from './index-of';
|
|
11
11
|
export { insert } from './insert';
|
|
12
12
|
export type { CallbackSorter, Key, KeySorter, KeyedValue, NestedArray, NumericalKeys, PlainObject, } from './models';
|
|
13
13
|
export { push } from './push';
|
|
14
14
|
export { sort } from './sort';
|
|
15
15
|
export { splice } from './splice';
|
|
16
|
-
export { toMap
|
|
17
|
-
export { toRecord
|
|
16
|
+
export { toMap } from './to-map';
|
|
17
|
+
export { toRecord } from './to-record';
|
|
18
18
|
export { toSet } from './to-set';
|
|
19
19
|
export { unique } from './unique';
|
package/types/array/to-map.d.ts
CHANGED
|
@@ -63,6 +63,9 @@ export declare function toMap<Item extends PlainObject, ItemKey extends keyof It
|
|
|
63
63
|
* @returns Map of indiced items
|
|
64
64
|
*/
|
|
65
65
|
export declare function toMap<Item>(array: Item[]): Map<number, Item>;
|
|
66
|
+
export declare namespace toMap {
|
|
67
|
+
var arrays: typeof toMapArrays;
|
|
68
|
+
}
|
|
66
69
|
/**
|
|
67
70
|
* Create a Map from an array of items using callbacks, grouping values into arrays
|
|
68
71
|
* @param array Array to convert
|
|
@@ -70,7 +73,7 @@ export declare function toMap<Item>(array: Item[]): Map<number, Item>;
|
|
|
70
73
|
* @param value Callback to get an item's value
|
|
71
74
|
* @returns Map of keyed arrays of values
|
|
72
75
|
*/
|
|
73
|
-
|
|
76
|
+
declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
|
|
74
77
|
/**
|
|
75
78
|
* Create a Map from an array of items using a callback and value, grouping values into arrays
|
|
76
79
|
* @param array Array to convert
|
|
@@ -78,7 +81,7 @@ export declare function toMapArrays<Item, KeyCallback extends (item: Item, index
|
|
|
78
81
|
* @param value Key to use for value
|
|
79
82
|
* @returns Map of keyed arrays of values
|
|
80
83
|
*/
|
|
81
|
-
|
|
84
|
+
declare function toMapArrays<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue][]>;
|
|
82
85
|
/**
|
|
83
86
|
* Create a Map from an array of items using a key and callback, grouping values into arrays
|
|
84
87
|
* @param array Array to convert
|
|
@@ -86,7 +89,7 @@ export declare function toMapArrays<Item extends PlainObject, KeyCallback extend
|
|
|
86
89
|
* @param value Callback to get an item's value
|
|
87
90
|
* @returns Map of keyed arrays of values
|
|
88
91
|
*/
|
|
89
|
-
|
|
92
|
+
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Map<Item[ItemKey], ReturnType<ValueCallback>[]>;
|
|
90
93
|
/**
|
|
91
94
|
* Create a Map from an array of items using a key and value, grouping values into arrays
|
|
92
95
|
* @param array Array to convert
|
|
@@ -94,18 +97,19 @@ export declare function toMapArrays<Item extends PlainObject, ItemKey extends ke
|
|
|
94
97
|
* @param value Key to use for value
|
|
95
98
|
* @returns Map of keyed arrays of values
|
|
96
99
|
*/
|
|
97
|
-
|
|
100
|
+
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ItemValue extends keyof Item>(array: Item[], key: ItemKey, value: ItemValue): Map<Item[ItemKey], Item[ItemValue][]>;
|
|
98
101
|
/**
|
|
99
102
|
* Create a Map from an array of items using a callback, grouping items into arrays
|
|
100
103
|
* @param array Array to convert
|
|
101
104
|
* @param callback Callback to get an item's grouping key
|
|
102
105
|
* @returns Map of keyed arrays of items
|
|
103
106
|
*/
|
|
104
|
-
|
|
107
|
+
declare function toMapArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item[]>;
|
|
105
108
|
/**
|
|
106
109
|
* Create a Map from an array of items using a key, grouping items into arrays
|
|
107
110
|
* @param array Array to convert
|
|
108
111
|
* @param key Key to use for grouping
|
|
109
112
|
* @returns Map of keyed arrays of items
|
|
110
113
|
*/
|
|
111
|
-
|
|
114
|
+
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Map<Item[ItemKey], Item[]>;
|
|
115
|
+
export {};
|
|
@@ -63,6 +63,9 @@ export declare function toRecord<Item extends PlainObject, ItemKey extends keyof
|
|
|
63
63
|
* @returns Record of indiced values
|
|
64
64
|
*/
|
|
65
65
|
export declare function toRecord<Item>(array: Item[]): Record<number, Item>;
|
|
66
|
+
export declare namespace toRecord {
|
|
67
|
+
var arrays: typeof toRecordArrays;
|
|
68
|
+
}
|
|
66
69
|
/**
|
|
67
70
|
* Create a record from an array of items using callbacks, grouping values into arrays
|
|
68
71
|
* @param array Array to convert
|
|
@@ -70,7 +73,7 @@ export declare function toRecord<Item>(array: Item[]): Record<number, Item>;
|
|
|
70
73
|
* @param value Callback to get an item's value
|
|
71
74
|
* @returns Record of keyed arrays of values
|
|
72
75
|
*/
|
|
73
|
-
|
|
76
|
+
declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
|
|
74
77
|
/**
|
|
75
78
|
* Create a record from an array of items using a callback and value, grouping values into arrays
|
|
76
79
|
* @param array Array to convert
|
|
@@ -78,7 +81,7 @@ export declare function toRecordArrays<Item, KeyCallback extends (item: Item, in
|
|
|
78
81
|
* @param value Key to use for value
|
|
79
82
|
* @returns Record of keyed arrays of values
|
|
80
83
|
*/
|
|
81
|
-
|
|
84
|
+
declare function toRecordArrays<Item extends PlainObject, Callback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], callback: Callback, value: ItemValue): Record<ReturnType<Callback>, Item[ItemValue][]>;
|
|
82
85
|
/**
|
|
83
86
|
* Create a record from an array of items using a key and callback, grouping values into arrays
|
|
84
87
|
* @param array Array to convert
|
|
@@ -86,7 +89,7 @@ export declare function toRecordArrays<Item extends PlainObject, Callback extend
|
|
|
86
89
|
* @param callback Callback to get an item's value
|
|
87
90
|
* @returns Record of keyed arrays of values
|
|
88
91
|
*/
|
|
89
|
-
|
|
92
|
+
declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, callback: Callback): Simplify<Record<KeyedValue<Item, ItemKey>, ReturnType<Callback>[]>>;
|
|
90
93
|
/**
|
|
91
94
|
* Create a record from an array of items using a key and value, grouping values into arrays
|
|
92
95
|
* @param array Array to convert
|
|
@@ -94,18 +97,19 @@ export declare function toRecordArrays<Item extends PlainObject, ItemKey extends
|
|
|
94
97
|
* @param value Key to use for value
|
|
95
98
|
* @returns Record of keyed arrays of values
|
|
96
99
|
*/
|
|
97
|
-
|
|
100
|
+
declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item, ItemValue extends keyof Item>(array: Item[], key: ItemKey, value: ItemValue): Simplify<Record<KeyedValue<Item, ItemKey>, Item[ItemValue][]>>;
|
|
98
101
|
/**
|
|
99
102
|
* Create a record from an array of items using a callback, grouping items into arrays
|
|
100
103
|
* @param array Array to convert
|
|
101
104
|
* @param callback Callback to get an item's grouping key
|
|
102
105
|
* @returns Record of keyed arrays of items
|
|
103
106
|
*/
|
|
104
|
-
|
|
107
|
+
declare function toRecordArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item[]>;
|
|
105
108
|
/**
|
|
106
109
|
* Create a record from an array of items using a key, grouping items into arrays
|
|
107
110
|
* @param array Array to convert
|
|
108
111
|
* @param key Key to use for grouping
|
|
109
112
|
* @returns Record of keyed arrays of items
|
|
110
113
|
*/
|
|
111
|
-
|
|
114
|
+
declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
|
|
115
|
+
export {};
|
|
@@ -35,10 +35,7 @@ export declare function equal(first: string, second: string, ignoreCase?: boolea
|
|
|
35
35
|
* @returns `true` if the values are equal, otherwise `false`
|
|
36
36
|
*/
|
|
37
37
|
export declare function equal(first: unknown, second: unknown, options?: EqualOptions): boolean;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* @returns Equalizer function
|
|
42
|
-
*/
|
|
43
|
-
export declare function equalizer(options?: EqualOptions): Equalizer;
|
|
38
|
+
export declare namespace equal {
|
|
39
|
+
var initialize: (options?: EqualOptions) => Equalizer;
|
|
40
|
+
}
|
|
44
41
|
export {};
|
package/types/string/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { getString, join, words } from '../internal/string';
|
|
|
2
2
|
export type { PlainObject } from '../models';
|
|
3
3
|
export { camelCase, capitalize, kebabCase, pascalCase, snakeCase, titleCase } from './case';
|
|
4
4
|
export { createUuid, getUuid, parse, truncate } from './misc';
|
|
5
|
-
export { template
|
|
5
|
+
export { template } from './template';
|
|
@@ -24,10 +24,7 @@ type Templater = (value: string, variables?: PlainObject) => string;
|
|
|
24
24
|
* @returns Templated string
|
|
25
25
|
*/
|
|
26
26
|
export declare function template(value: string, variables: PlainObject, options?: Partial<TemplateOptions>): string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* @returns Templater function
|
|
31
|
-
*/
|
|
32
|
-
export declare function templater(options?: Partial<TemplateOptions>): Templater;
|
|
27
|
+
export declare namespace template {
|
|
28
|
+
var initialize: (options?: Partial<TemplateOptions>) => Templater;
|
|
29
|
+
}
|
|
33
30
|
export {};
|
package/types/value/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { compare } from '../internal/value/compare';
|
|
2
2
|
export { diff } from './diff';
|
|
3
|
-
export { equal
|
|
3
|
+
export { equal } from '../internal/value/equal';
|
|
4
4
|
export { getValue } from '../internal/value/get';
|
|
5
5
|
export { setValue } from '../internal/value/set';
|
|
6
6
|
export type { ArrayOrPlainObject, NestedPartial, PlainObject } from '../models';
|
|
7
7
|
export { clone } from './clone';
|
|
8
|
-
export { merge
|
|
8
|
+
export { merge } from './merge';
|
|
9
9
|
export { partial } from './partial';
|
|
10
10
|
export { smush } from './smush';
|
|
11
11
|
export { unsmush } from './unsmush';
|
package/types/value/merge.d.ts
CHANGED
|
@@ -31,10 +31,7 @@ type Merger<Model extends ArrayOrPlainObject = ArrayOrPlainObject> = (values: Ne
|
|
|
31
31
|
* @returns Merged value
|
|
32
32
|
*/
|
|
33
33
|
export declare function merge<Model extends ArrayOrPlainObject>(values: NestedPartial<Model>[], options?: Partial<MergeOptions>): Model;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* @returns Merger function
|
|
38
|
-
*/
|
|
39
|
-
export declare function merger(options?: Partial<MergeOptions>): Merger;
|
|
34
|
+
export declare namespace merge {
|
|
35
|
+
var initialize: (options?: Partial<MergeOptions>) => Merger;
|
|
36
|
+
}
|
|
40
37
|
export {};
|