@duplojs/utils 1.4.57 → 1.4.59
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.cjs +11 -11
- package/dist/array/group.d.ts +1 -1
- package/dist/array/group.mjs +11 -11
- package/dist/clean/constraint/base.d.ts +6 -4
- package/dist/clean/constraint/defaultConstraint/index.d.ts +1 -0
- package/dist/clean/constraint/defaultConstraint/number.d.ts +6 -6
- package/dist/clean/constraint/defaultConstraint/string.d.ts +4 -4
- package/dist/clean/constraint/defaultConstraint/time.cjs +19 -0
- package/dist/clean/constraint/defaultConstraint/time.d.ts +61 -0
- package/dist/clean/constraint/defaultConstraint/time.mjs +16 -0
- package/dist/clean/constraint/set.d.ts +6 -4
- package/dist/clean/entity.d.ts +2 -1
- package/dist/clean/index.cjs +3 -0
- package/dist/clean/index.mjs +1 -0
- package/dist/clean/newType.d.ts +7 -5
- package/dist/clean/primitive/base.d.ts +25 -34
- package/dist/clean/primitive/operations/date/dateAddTime.d.ts +7 -11
- package/dist/clean/primitive/operations/date/dateGreaterThan.d.ts +9 -7
- package/dist/clean/primitive/operations/date/dateLessThan.d.ts +9 -7
- package/dist/clean/primitive/operations/date/dateMax.d.ts +3 -10
- package/dist/clean/primitive/operations/date/dateMin.d.ts +3 -10
- package/dist/clean/primitive/operations/date/dateSubtractTime.d.ts +7 -11
- package/dist/clean/primitive/operations/equal.cjs +1 -1
- package/dist/clean/primitive/operations/equal.d.ts +3 -3
- package/dist/clean/primitive/operations/equal.mjs +1 -1
- package/dist/clean/primitive/operations/sort.d.ts +8 -10
- package/dist/clean/primitive/operations/time/timeGreaterThan.d.ts +11 -9
- package/dist/clean/primitive/operations/time/timeLessThan.d.ts +11 -9
- package/dist/clean/primitive/operations/time/timeMax.cjs +2 -2
- package/dist/clean/primitive/operations/time/timeMax.d.ts +10 -17
- package/dist/clean/primitive/operations/time/timeMax.mjs +2 -2
- package/dist/clean/primitive/operations/time/timeMin.cjs +3 -3
- package/dist/clean/primitive/operations/time/timeMin.d.ts +10 -17
- package/dist/clean/primitive/operations/time/timeMin.mjs +3 -3
- package/dist/clean/unwrapEntity.cjs +13 -3
- package/dist/clean/unwrapEntity.d.ts +57 -5
- package/dist/clean/unwrapEntity.mjs +13 -3
- package/dist/common/index.d.ts +3 -4
- package/dist/common/kind.d.ts +1 -0
- package/dist/common/path.cjs +13 -13
- package/dist/common/path.d.ts +17 -11
- package/dist/common/path.mjs +13 -13
- package/dist/common/toRegExp.cjs +19 -0
- package/dist/common/toRegExp.d.ts +31 -0
- package/dist/common/toRegExp.mjs +17 -0
- package/dist/common/transformer.cjs +45 -0
- package/dist/common/transformer.d.ts +61 -0
- package/dist/common/transformer.mjs +40 -0
- package/dist/common/types/DeepReadonly.d.ts +1 -1
- package/dist/common/types/toLargeEnsemble.d.ts +2 -2
- package/dist/dataParser/error.cjs +4 -2
- package/dist/dataParser/error.d.ts +4 -2
- package/dist/dataParser/error.mjs +4 -2
- package/dist/dataParser/extended/date.d.ts +9 -4
- package/dist/dataParser/extended/time.d.ts +28 -12
- package/dist/dataParser/identifier.d.ts +20 -8
- package/dist/dataParser/parsers/date.cjs +16 -12
- package/dist/dataParser/parsers/date.d.ts +15 -9
- package/dist/dataParser/parsers/date.mjs +16 -12
- package/dist/dataParser/parsers/time/checkers/max.cjs +3 -0
- package/dist/dataParser/parsers/time/checkers/max.d.ts +28 -0
- package/dist/dataParser/parsers/time/checkers/max.mjs +3 -0
- package/dist/dataParser/parsers/time/checkers/min.cjs +3 -0
- package/dist/dataParser/parsers/time/checkers/min.d.ts +28 -0
- package/dist/dataParser/parsers/time/checkers/min.mjs +3 -0
- package/dist/dataParser/parsers/time/index.cjs +14 -10
- package/dist/dataParser/parsers/time/index.d.ts +15 -9
- package/dist/dataParser/parsers/time/index.mjs +14 -10
- package/dist/date/applyTimezone.cjs +4 -4
- package/dist/date/applyTimezone.d.ts +18 -16
- package/dist/date/applyTimezone.mjs +2 -2
- package/dist/date/closestTo.cjs +6 -2
- package/dist/date/closestTo.d.ts +15 -15
- package/dist/date/closestTo.mjs +6 -2
- package/dist/date/constants.cjs +4 -4
- package/dist/date/constants.d.ts +2 -2
- package/dist/date/constants.mjs +3 -3
- package/dist/date/create.cjs +20 -10
- package/dist/date/create.d.ts +24 -38
- package/dist/date/create.mjs +21 -11
- package/dist/date/createOrThrow.d.ts +18 -20
- package/dist/date/createTime.cjs +16 -7
- package/dist/date/createTime.d.ts +19 -18
- package/dist/date/createTime.mjs +17 -8
- package/dist/date/createTimeOrThrow.d.ts +17 -20
- package/dist/date/each.cjs +6 -4
- package/dist/date/each.d.ts +21 -19
- package/dist/date/each.mjs +6 -4
- package/dist/date/format.d.ts +17 -15
- package/dist/date/formatTime.d.ts +17 -16
- package/dist/date/getTimezoneOffset.cjs +6 -3
- package/dist/date/getTimezoneOffset.d.ts +17 -18
- package/dist/date/getTimezoneOffset.mjs +6 -3
- package/dist/date/getters/getDayOfMonth.cjs +3 -3
- package/dist/date/getters/getDayOfMonth.d.ts +20 -14
- package/dist/date/getters/getDayOfMonth.mjs +3 -3
- package/dist/date/getters/getDayOfWeek.cjs +3 -3
- package/dist/date/getters/getDayOfWeek.d.ts +15 -12
- package/dist/date/getters/getDayOfWeek.mjs +3 -3
- package/dist/date/getters/getDayOfYear.cjs +6 -6
- package/dist/date/getters/getDayOfYear.d.ts +21 -13
- package/dist/date/getters/getDayOfYear.mjs +6 -6
- package/dist/date/getters/getFirstDayOfMonth.cjs +2 -3
- package/dist/date/getters/getFirstDayOfMonth.d.ts +16 -10
- package/dist/date/getters/getFirstDayOfMonth.mjs +2 -3
- package/dist/date/getters/getFirstDayOfWeek.cjs +2 -3
- package/dist/date/getters/getFirstDayOfWeek.d.ts +17 -10
- package/dist/date/getters/getFirstDayOfWeek.mjs +2 -3
- package/dist/date/getters/getHour.cjs +3 -3
- package/dist/date/getters/getHour.d.ts +16 -14
- package/dist/date/getters/getHour.mjs +3 -3
- package/dist/date/getters/getLastDayOfMonth.cjs +2 -3
- package/dist/date/getters/getLastDayOfMonth.d.ts +16 -10
- package/dist/date/getters/getLastDayOfMonth.mjs +2 -3
- package/dist/date/getters/getLastDayOfWeek.cjs +2 -3
- package/dist/date/getters/getLastDayOfWeek.d.ts +17 -10
- package/dist/date/getters/getLastDayOfWeek.mjs +2 -3
- package/dist/date/getters/getMilliseconds.cjs +2 -2
- package/dist/date/getters/getMilliseconds.d.ts +11 -9
- package/dist/date/getters/getMilliseconds.mjs +2 -2
- package/dist/date/getters/getMinute.cjs +3 -3
- package/dist/date/getters/getMinute.d.ts +17 -15
- package/dist/date/getters/getMinute.mjs +3 -3
- package/dist/date/getters/getMonth.cjs +3 -3
- package/dist/date/getters/getMonth.d.ts +20 -15
- package/dist/date/getters/getMonth.mjs +3 -3
- package/dist/date/getters/getSecond.cjs +3 -3
- package/dist/date/getters/getSecond.d.ts +17 -15
- package/dist/date/getters/getSecond.mjs +3 -3
- package/dist/date/getters/getWeekOfYear.cjs +12 -11
- package/dist/date/getters/getWeekOfYear.d.ts +17 -11
- package/dist/date/getters/getWeekOfYear.mjs +12 -11
- package/dist/date/getters/getYear.cjs +3 -3
- package/dist/date/getters/getYear.d.ts +16 -15
- package/dist/date/getters/getYear.mjs +3 -3
- package/dist/date/index.cjs +12 -6
- package/dist/date/index.d.ts +5 -2
- package/dist/date/index.mjs +6 -3
- package/dist/date/is.cjs +3 -8
- package/dist/date/is.d.ts +9 -14
- package/dist/date/is.mjs +3 -8
- package/dist/date/isSafeTimeValue.d.ts +9 -13
- package/dist/date/isSafeTimestamp.d.ts +7 -16
- package/dist/date/isSerializedTheDate.cjs +20 -0
- package/dist/date/isSerializedTheDate.d.ts +31 -0
- package/dist/date/isSerializedTheDate.mjs +18 -0
- package/dist/date/isSerializedTheTime.cjs +20 -0
- package/dist/date/isSerializedTheTime.d.ts +31 -0
- package/dist/date/isSerializedTheTime.mjs +18 -0
- package/dist/date/isTime.cjs +3 -8
- package/dist/date/isTime.d.ts +7 -14
- package/dist/date/isTime.mjs +3 -8
- package/dist/date/kind.cjs +9 -0
- package/dist/date/kind.d.ts +1 -0
- package/dist/date/kind.mjs +7 -0
- package/dist/date/makeSafeTimeValue.d.ts +12 -11
- package/dist/date/makeSafeTimestamp.d.ts +12 -11
- package/dist/date/max.cjs +2 -2
- package/dist/date/max.d.ts +13 -13
- package/dist/date/max.mjs +2 -2
- package/dist/date/maxTime.cjs +2 -2
- package/dist/date/maxTime.d.ts +13 -21
- package/dist/date/maxTime.mjs +2 -2
- package/dist/date/min.cjs +2 -2
- package/dist/date/min.d.ts +13 -13
- package/dist/date/min.mjs +2 -2
- package/dist/date/minTime.cjs +2 -2
- package/dist/date/minTime.d.ts +13 -21
- package/dist/date/minTime.mjs +2 -2
- package/dist/date/now.cjs +3 -1
- package/dist/date/now.d.ts +9 -7
- package/dist/date/now.mjs +3 -1
- package/dist/date/operators/addDays.cjs +3 -5
- package/dist/date/operators/addDays.d.ts +14 -11
- package/dist/date/operators/addDays.mjs +3 -5
- package/dist/date/operators/addHours.cjs +3 -5
- package/dist/date/operators/addHours.d.ts +14 -11
- package/dist/date/operators/addHours.mjs +3 -5
- package/dist/date/operators/addMilliseconds.cjs +3 -5
- package/dist/date/operators/addMilliseconds.d.ts +14 -11
- package/dist/date/operators/addMilliseconds.mjs +3 -5
- package/dist/date/operators/addMinutes.cjs +3 -5
- package/dist/date/operators/addMinutes.d.ts +14 -11
- package/dist/date/operators/addMinutes.mjs +3 -5
- package/dist/date/operators/addMonths.cjs +2 -2
- package/dist/date/operators/addMonths.d.ts +13 -13
- package/dist/date/operators/addMonths.mjs +2 -2
- package/dist/date/operators/addSeconds.cjs +3 -5
- package/dist/date/operators/addSeconds.d.ts +14 -11
- package/dist/date/operators/addSeconds.mjs +3 -5
- package/dist/date/operators/addTime.cjs +13 -6
- package/dist/date/operators/addTime.d.ts +20 -18
- package/dist/date/operators/addTime.mjs +13 -6
- package/dist/date/operators/addWeeks.cjs +6 -5
- package/dist/date/operators/addWeeks.d.ts +14 -11
- package/dist/date/operators/addWeeks.mjs +6 -5
- package/dist/date/operators/addYears.cjs +2 -2
- package/dist/date/operators/addYears.d.ts +13 -13
- package/dist/date/operators/addYears.mjs +2 -2
- package/dist/date/operators/between.d.ts +11 -11
- package/dist/date/operators/betweenThan.d.ts +11 -11
- package/dist/date/operators/betweenThanTime.d.ts +18 -22
- package/dist/date/operators/betweenTime.d.ts +17 -21
- package/dist/date/operators/greater.d.ts +12 -9
- package/dist/date/operators/greaterThan.d.ts +14 -11
- package/dist/date/operators/greaterThanTime.d.ts +17 -21
- package/dist/date/operators/greaterTime.d.ts +16 -20
- package/dist/date/operators/less.d.ts +12 -9
- package/dist/date/operators/lessThan.d.ts +13 -10
- package/dist/date/operators/lessThanTime.d.ts +17 -21
- package/dist/date/operators/lessTime.d.ts +16 -20
- package/dist/date/operators/subtractDays.cjs +3 -5
- package/dist/date/operators/subtractDays.d.ts +14 -11
- package/dist/date/operators/subtractDays.mjs +3 -5
- package/dist/date/operators/subtractHours.cjs +3 -5
- package/dist/date/operators/subtractHours.d.ts +14 -11
- package/dist/date/operators/subtractHours.mjs +3 -5
- package/dist/date/operators/subtractMilliseconds.cjs +3 -5
- package/dist/date/operators/subtractMilliseconds.d.ts +14 -11
- package/dist/date/operators/subtractMilliseconds.mjs +3 -5
- package/dist/date/operators/subtractMinutes.cjs +3 -5
- package/dist/date/operators/subtractMinutes.d.ts +14 -11
- package/dist/date/operators/subtractMinutes.mjs +3 -5
- package/dist/date/operators/subtractMonths.cjs +2 -2
- package/dist/date/operators/subtractMonths.d.ts +17 -11
- package/dist/date/operators/subtractMonths.mjs +2 -2
- package/dist/date/operators/subtractSeconds.cjs +3 -5
- package/dist/date/operators/subtractSeconds.d.ts +14 -11
- package/dist/date/operators/subtractSeconds.mjs +3 -5
- package/dist/date/operators/subtractTime.cjs +13 -6
- package/dist/date/operators/subtractTime.d.ts +20 -18
- package/dist/date/operators/subtractTime.mjs +13 -6
- package/dist/date/operators/subtractWeeks.cjs +3 -5
- package/dist/date/operators/subtractWeeks.d.ts +14 -11
- package/dist/date/operators/subtractWeeks.mjs +3 -5
- package/dist/date/operators/subtractYears.cjs +2 -2
- package/dist/date/operators/subtractYears.d.ts +17 -11
- package/dist/date/operators/subtractYears.mjs +2 -2
- package/dist/date/round.cjs +2 -2
- package/dist/date/round.d.ts +11 -14
- package/dist/date/round.mjs +2 -2
- package/dist/date/serialize.cjs +14 -0
- package/dist/date/serialize.d.ts +41 -0
- package/dist/date/serialize.mjs +12 -0
- package/dist/date/sort.cjs +2 -2
- package/dist/date/sort.d.ts +16 -15
- package/dist/date/sort.mjs +2 -2
- package/dist/date/sortTimes.cjs +2 -2
- package/dist/date/sortTimes.d.ts +15 -21
- package/dist/date/sortTimes.mjs +2 -2
- package/dist/date/theDate.cjs +124 -0
- package/dist/date/theDate.d.ts +114 -0
- package/dist/date/theDate.mjs +122 -0
- package/dist/date/theTime.cjs +36 -0
- package/dist/date/theTime.d.ts +53 -0
- package/dist/date/theTime.mjs +34 -0
- package/dist/date/timezone.cjs +3 -0
- package/dist/date/timezone.d.ts +27 -0
- package/dist/date/timezone.mjs +3 -0
- package/dist/date/toISOString.cjs +5 -2
- package/dist/date/toISOString.d.ts +12 -10
- package/dist/date/toISOString.mjs +5 -2
- package/dist/date/toNative.cjs +4 -0
- package/dist/date/toNative.d.ts +12 -10
- package/dist/date/toNative.mjs +4 -0
- package/dist/date/toTimeValue.cjs +6 -2
- package/dist/date/toTimeValue.d.ts +14 -12
- package/dist/date/toTimeValue.mjs +6 -2
- package/dist/date/toTimestamp.cjs +5 -3
- package/dist/date/toTimestamp.d.ts +11 -9
- package/dist/date/toTimestamp.mjs +6 -4
- package/dist/date/today.cjs +3 -1
- package/dist/date/today.d.ts +14 -7
- package/dist/date/today.mjs +3 -1
- package/dist/date/tomorrow.cjs +2 -1
- package/dist/date/tomorrow.d.ts +12 -7
- package/dist/date/tomorrow.mjs +2 -1
- package/dist/date/types/index.d.ts +2 -2
- package/dist/date/types/serializedTheDate.d.ts +1 -0
- package/dist/date/types/serializedTheTime.d.ts +42 -0
- package/dist/date/types/spoolingDate.d.ts +2 -1
- package/dist/date/yesterday.cjs +2 -1
- package/dist/date/yesterday.d.ts +12 -7
- package/dist/date/yesterday.mjs +2 -1
- package/dist/generator/asyncGroup.cjs +31 -0
- package/dist/generator/asyncGroup.d.ts +39 -0
- package/dist/generator/asyncGroup.mjs +29 -0
- package/dist/generator/group.cjs +39 -0
- package/dist/generator/group.d.ts +101 -0
- package/dist/generator/group.mjs +36 -0
- package/dist/generator/index.cjs +5 -0
- package/dist/generator/index.d.ts +3 -0
- package/dist/generator/index.mjs +2 -0
- package/dist/index.cjs +7 -6
- package/dist/index.mjs +2 -3
- package/dist/metadata.json +94 -40
- package/dist/object/entries.cjs +7 -2
- package/dist/object/entries.mjs +7 -2
- package/dist/object/keys.cjs +7 -2
- package/dist/object/keys.d.ts +1 -1
- package/dist/object/keys.mjs +7 -2
- package/package.json +1 -1
- package/dist/common/toJSON.cjs +0 -37
- package/dist/common/toJSON.d.ts +0 -44
- package/dist/common/toJSON.mjs +0 -35
- package/dist/common/toString.cjs +0 -10
- package/dist/common/toString.d.ts +0 -17
- package/dist/common/toString.mjs +0 -8
- package/dist/common/toTransform.cjs +0 -37
- package/dist/common/toTransform.d.ts +0 -50
- package/dist/common/toTransform.mjs +0 -35
- package/dist/date/createTheDate.cjs +0 -13
- package/dist/date/createTheDate.d.ts +0 -28
- package/dist/date/createTheDate.mjs +0 -11
- package/dist/date/createTheTime.cjs +0 -13
- package/dist/date/createTheTime.d.ts +0 -25
- package/dist/date/createTheTime.mjs +0 -11
- package/dist/date/types/theDate.d.ts +0 -11
- package/dist/date/types/theTime.d.ts +0 -10
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MaybePromise } from "../common";
|
|
2
|
+
import { type GroupFunctionOutput, type GroupFunctionParams, type GroupResult } from "./group";
|
|
3
|
+
/**
|
|
4
|
+
* Groups elements from an async iterable into an object by a group name.
|
|
5
|
+
*
|
|
6
|
+
* **Supported call styles:**
|
|
7
|
+
* - Classic: `asyncGroup(asyncIterator, theFunction)` → returns a promise of grouped object
|
|
8
|
+
* - Curried: `asyncGroup(theFunction)` → returns a function waiting for the async iterator
|
|
9
|
+
*
|
|
10
|
+
* Behavior:
|
|
11
|
+
* - The function receives `(element, { index, output })`
|
|
12
|
+
* - `theFunction` can return a value or a promise of value
|
|
13
|
+
* - `output` is `groupOutput` and returns `{ group, value }`
|
|
14
|
+
* - The input async iterator is not mutated
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const asyncValues = (async function *() {
|
|
18
|
+
* yield Promise.resolve(1);
|
|
19
|
+
* yield 2;
|
|
20
|
+
* yield 3;
|
|
21
|
+
* yield 4;
|
|
22
|
+
* })();
|
|
23
|
+
*
|
|
24
|
+
* await G.asyncGroup(
|
|
25
|
+
* asyncValues,
|
|
26
|
+
* (value, { output }) => output(value % 2 ? "odd" : "even", value),
|
|
27
|
+
* );
|
|
28
|
+
* // { odd: [1, 3], even: [2, 4] }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see [`G.group`](https://utils.duplojs.dev/en/v1/api/generator/group) For sync iterables
|
|
32
|
+
* @see [`G.groupOutput`](https://utils.duplojs.dev/en/v1/api/generator/groupOutput) For creating group outputs
|
|
33
|
+
* @see https://utils.duplojs.dev/en/v1/api/generator/asyncGroup
|
|
34
|
+
*
|
|
35
|
+
* @namespace G
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export declare function asyncGroup<GenericElement extends unknown, GenericOutput extends GroupFunctionOutput>(theFunction: (element: GenericElement, params: GroupFunctionParams) => MaybePromise<GenericOutput>): (asyncIterator: AsyncIterable<GenericElement>) => Promise<GroupResult<GenericOutput>>;
|
|
39
|
+
export declare function asyncGroup<GenericElement extends unknown, GenericOutput extends GroupFunctionOutput>(asyncIterator: AsyncIterable<GenericElement>, theFunction: (element: GenericElement, params: GroupFunctionParams) => MaybePromise<GenericOutput>): Promise<GroupResult<GenericOutput>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { groupOutput } from './group.mjs';
|
|
2
|
+
|
|
3
|
+
function asyncGroup(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [theFunction] = args;
|
|
6
|
+
return (asyncIterator) => asyncGroup(asyncIterator, theFunction);
|
|
7
|
+
}
|
|
8
|
+
const [asyncIterator, theFunction] = args;
|
|
9
|
+
const result = {};
|
|
10
|
+
let index = 0;
|
|
11
|
+
return (async () => {
|
|
12
|
+
for await (const element of asyncIterator) {
|
|
13
|
+
const { group, value } = await theFunction(element, {
|
|
14
|
+
index,
|
|
15
|
+
output: groupOutput,
|
|
16
|
+
});
|
|
17
|
+
if (result[group]) {
|
|
18
|
+
result[group].push(value);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
result[group] = [value];
|
|
22
|
+
}
|
|
23
|
+
index++;
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
})();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { asyncGroup };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function groupOutput(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [group] = args;
|
|
6
|
+
return (input) => groupOutput(group, input);
|
|
7
|
+
}
|
|
8
|
+
const [group, value] = args;
|
|
9
|
+
return {
|
|
10
|
+
group,
|
|
11
|
+
value,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function group(...args) {
|
|
15
|
+
if (args.length === 1) {
|
|
16
|
+
const [theFunction] = args;
|
|
17
|
+
return (iterator) => group(iterator, theFunction);
|
|
18
|
+
}
|
|
19
|
+
const [iterator, theFunction] = args;
|
|
20
|
+
const result = {};
|
|
21
|
+
let index = 0;
|
|
22
|
+
for (const element of iterator) {
|
|
23
|
+
const { group, value } = theFunction(element, {
|
|
24
|
+
index,
|
|
25
|
+
output: groupOutput,
|
|
26
|
+
});
|
|
27
|
+
if (result[group]) {
|
|
28
|
+
result[group].push(value);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
result[group] = [value];
|
|
32
|
+
}
|
|
33
|
+
index++;
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.group = group;
|
|
39
|
+
exports.groupOutput = groupOutput;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { SimplifyTopLevel } from "../common";
|
|
2
|
+
export interface GroupFunctionOutput<GenericGroupName extends string = string, GenericGroupValue extends unknown = unknown> {
|
|
3
|
+
group: GenericGroupName;
|
|
4
|
+
value: GenericGroupValue;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Creates a group output object for `group` and `asyncGroup`.
|
|
8
|
+
*
|
|
9
|
+
* **Supported call styles:**
|
|
10
|
+
* - Classic: `groupOutput(group, value)` → returns a group output
|
|
11
|
+
* - Curried: `groupOutput(group)` → returns a function waiting for the value
|
|
12
|
+
*
|
|
13
|
+
* Behavior:
|
|
14
|
+
* - The returned object always has `{ group, value }`
|
|
15
|
+
* - The `group` name is preserved as a string literal when possible
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* G.groupOutput(
|
|
19
|
+
* "even",
|
|
20
|
+
* 2,
|
|
21
|
+
* ); // { group: "even", value: 2 }
|
|
22
|
+
*
|
|
23
|
+
* pipe(
|
|
24
|
+
* "alpha",
|
|
25
|
+
* G.groupOutput("word"),
|
|
26
|
+
* ); // { group: "word", value: "alpha" }
|
|
27
|
+
*
|
|
28
|
+
* G.groupOutput(
|
|
29
|
+
* "status",
|
|
30
|
+
* {
|
|
31
|
+
* ok: true,
|
|
32
|
+
* },
|
|
33
|
+
* ); // { group: "status", value: { ok: true } }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @see [`G.group`](https://utils.duplojs.dev/en/v1/api/generator/group) For grouping sync iterables
|
|
37
|
+
* @see [`G.asyncGroup`](https://utils.duplojs.dev/en/v1/api/generator/asyncGroup) For grouping async iterables
|
|
38
|
+
* @see https://utils.duplojs.dev/en/v1/api/generator/groupOutput
|
|
39
|
+
*
|
|
40
|
+
* @namespace G
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
export declare function groupOutput<const GenericGroupName extends string, GenericGroupValue extends unknown>(group: GenericGroupName): (value: GenericGroupValue) => GroupFunctionOutput<GenericGroupName, GenericGroupValue>;
|
|
44
|
+
export declare function groupOutput<const GenericGroupName extends string, GenericGroupValue extends unknown>(group: GenericGroupName, value: GenericGroupValue): GroupFunctionOutput<GenericGroupName, GenericGroupValue>;
|
|
45
|
+
export interface GroupFunctionParams {
|
|
46
|
+
index: number;
|
|
47
|
+
output: typeof groupOutput;
|
|
48
|
+
}
|
|
49
|
+
export type GroupResult<GenericOutput extends GroupFunctionOutput> = SimplifyTopLevel<{
|
|
50
|
+
[Output in GenericOutput as Output["group"]]?: Output["value"][];
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Groups elements from an iterable into an object by a group name.
|
|
54
|
+
*
|
|
55
|
+
* **Supported call styles:**
|
|
56
|
+
* - Classic: `group(iterator, theFunction)` → returns a grouped object
|
|
57
|
+
* - Curried: `group(theFunction)` → returns a function waiting for the iterator
|
|
58
|
+
*
|
|
59
|
+
* Behavior:
|
|
60
|
+
* - The function receives `(element, { index, output })`
|
|
61
|
+
* - `output` is `groupOutput` and returns `{ group, value }`
|
|
62
|
+
* - The input iterator is not mutated
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* G.group(
|
|
66
|
+
* [1, 2, 3, 4],
|
|
67
|
+
* (value, { output }) => output(value % 2 ? "odd" : "even", value),
|
|
68
|
+
* );
|
|
69
|
+
* // { odd: [1, 3], even: [2, 4] }
|
|
70
|
+
*
|
|
71
|
+
* pipe(
|
|
72
|
+
* new Set(["alpha", "beta", "gamma"]),
|
|
73
|
+
* G.group((value, { index, output }) => output(
|
|
74
|
+
* "entry",
|
|
75
|
+
* {
|
|
76
|
+
* index,
|
|
77
|
+
* value,
|
|
78
|
+
* },
|
|
79
|
+
* )),
|
|
80
|
+
* );
|
|
81
|
+
* // { entry: [{ index: 0, value: "alpha" }, ...] }
|
|
82
|
+
*
|
|
83
|
+
* G.group(
|
|
84
|
+
* ["apple", "pear", "plum"],
|
|
85
|
+
* (value, { output }) => output(
|
|
86
|
+
* value.startsWith("p") ? "startsWithP" : "other",
|
|
87
|
+
* value.length,
|
|
88
|
+
* ),
|
|
89
|
+
* );
|
|
90
|
+
* // { startsWithP: [5, 4, 4] }
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @see [`G.groupOutput`](https://utils.duplojs.dev/en/v1/api/generator/groupOutput) For creating group outputs
|
|
94
|
+
* @see [`G.asyncGroup`](https://utils.duplojs.dev/en/v1/api/generator/asyncGroup) For async iterables
|
|
95
|
+
* @see https://utils.duplojs.dev/en/v1/api/generator/group
|
|
96
|
+
*
|
|
97
|
+
* @namespace G
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
export declare function group<GenericElement extends unknown, GenericOutput extends GroupFunctionOutput>(theFunction: (element: GenericElement, params: GroupFunctionParams) => GenericOutput): (iterator: Iterable<GenericElement>) => GroupResult<GenericOutput>;
|
|
101
|
+
export declare function group<GenericElement extends unknown, GenericOutput extends GroupFunctionOutput>(iterator: Iterable<GenericElement>, theFunction: (element: GenericElement, params: GroupFunctionParams) => GenericOutput): GroupResult<GenericOutput>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function groupOutput(...args) {
|
|
2
|
+
if (args.length === 1) {
|
|
3
|
+
const [group] = args;
|
|
4
|
+
return (input) => groupOutput(group, input);
|
|
5
|
+
}
|
|
6
|
+
const [group, value] = args;
|
|
7
|
+
return {
|
|
8
|
+
group,
|
|
9
|
+
value,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function group(...args) {
|
|
13
|
+
if (args.length === 1) {
|
|
14
|
+
const [theFunction] = args;
|
|
15
|
+
return (iterator) => group(iterator, theFunction);
|
|
16
|
+
}
|
|
17
|
+
const [iterator, theFunction] = args;
|
|
18
|
+
const result = {};
|
|
19
|
+
let index = 0;
|
|
20
|
+
for (const element of iterator) {
|
|
21
|
+
const { group, value } = theFunction(element, {
|
|
22
|
+
index,
|
|
23
|
+
output: groupOutput,
|
|
24
|
+
});
|
|
25
|
+
if (result[group]) {
|
|
26
|
+
result[group].push(value);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
result[group] = [value];
|
|
30
|
+
}
|
|
31
|
+
index++;
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { group, groupOutput };
|
package/dist/generator/index.cjs
CHANGED
|
@@ -11,6 +11,8 @@ var loop = require('./loop.cjs');
|
|
|
11
11
|
var asyncLoop = require('./asyncLoop.cjs');
|
|
12
12
|
var chunk = require('./chunk.cjs');
|
|
13
13
|
var asyncChunk = require('./asyncChunk.cjs');
|
|
14
|
+
var group = require('./group.cjs');
|
|
15
|
+
var asyncGroup = require('./asyncGroup.cjs');
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* {@include generator/index.md}
|
|
@@ -28,3 +30,6 @@ exports.loop = loop.loop;
|
|
|
28
30
|
exports.asyncLoop = asyncLoop.asyncLoop;
|
|
29
31
|
exports.chunk = chunk.chunk;
|
|
30
32
|
exports.asyncChunk = asyncChunk.asyncChunk;
|
|
33
|
+
exports.group = group.group;
|
|
34
|
+
exports.groupOutput = group.groupOutput;
|
|
35
|
+
exports.asyncGroup = asyncGroup.asyncGroup;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - reduce helpers (`G.reduceFrom`)
|
|
18
18
|
* - control and execution (`G.loop`, `G.execute`)
|
|
19
19
|
* - batching (`G.chunk`)
|
|
20
|
+
* - grouping (`G.group`, `G.groupOutput`, `G.asyncGroup`)
|
|
20
21
|
* - async variants (`G.asyncMap`, `G.asyncFilter`, `G.asyncReduce`, `G.asyncLoop`, `G.asyncChunk`)
|
|
21
22
|
*
|
|
22
23
|
* @see https://utils.duplojs.dev/en/v1/api/generator
|
|
@@ -35,3 +36,5 @@ export * from "./loop";
|
|
|
35
36
|
export * from "./asyncLoop";
|
|
36
37
|
export * from "./chunk";
|
|
37
38
|
export * from "./asyncChunk";
|
|
39
|
+
export * from "./group";
|
|
40
|
+
export * from "./asyncGroup";
|
package/dist/generator/index.mjs
CHANGED
|
@@ -9,6 +9,8 @@ export { loop } from './loop.mjs';
|
|
|
9
9
|
export { asyncLoop } from './asyncLoop.mjs';
|
|
10
10
|
export { chunk } from './chunk.mjs';
|
|
11
11
|
export { asyncChunk } from './asyncChunk.mjs';
|
|
12
|
+
export { group, groupOutput } from './group.mjs';
|
|
13
|
+
export { asyncGroup } from './asyncGroup.mjs';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* {@include generator/index.md}
|
package/dist/index.cjs
CHANGED
|
@@ -27,15 +27,12 @@ var sleep = require('./common/sleep.cjs');
|
|
|
27
27
|
var stringToBytes = require('./common/stringToBytes.cjs');
|
|
28
28
|
var mimeType = require('./common/mimeType.cjs');
|
|
29
29
|
var stringToMillisecond = require('./common/stringToMillisecond.cjs');
|
|
30
|
-
var toJSON = require('./common/toJSON.cjs');
|
|
31
|
-
var toTransform = require('./common/toTransform.cjs');
|
|
32
30
|
var toWrappedValue = require('./common/toWrappedValue.cjs');
|
|
33
31
|
var unwrap = require('./common/unwrap.cjs');
|
|
34
32
|
var unwrapGroup = require('./common/unwrapGroup.cjs');
|
|
35
33
|
var asyncLoop = require('./common/asyncLoop.cjs');
|
|
36
34
|
var asyncRetry = require('./common/asyncRetry.cjs');
|
|
37
35
|
var wrapValue = require('./common/wrapValue.cjs');
|
|
38
|
-
var toString = require('./common/toString.cjs');
|
|
39
36
|
var innerPipe = require('./common/innerPipe.cjs');
|
|
40
37
|
var asyncInnerPipe = require('./common/asyncInnerPipe.cjs');
|
|
41
38
|
var loop = require('./common/loop.cjs');
|
|
@@ -65,6 +62,8 @@ var toCurriedPredicate = require('./common/toCurriedPredicate.cjs');
|
|
|
65
62
|
var pipeCall = require('./common/pipeCall.cjs');
|
|
66
63
|
var asserts = require('./common/asserts.cjs');
|
|
67
64
|
var path = require('./common/path.cjs');
|
|
65
|
+
var transformer = require('./common/transformer.cjs');
|
|
66
|
+
var toRegExp = require('./common/toRegExp.cjs');
|
|
68
67
|
|
|
69
68
|
|
|
70
69
|
|
|
@@ -113,8 +112,6 @@ exports.stringToBytes = stringToBytes.stringToBytes;
|
|
|
113
112
|
exports.mimeType = mimeType.mimeType;
|
|
114
113
|
exports.InvalidMillisecondInStringError = stringToMillisecond.InvalidMillisecondInStringError;
|
|
115
114
|
exports.stringToMillisecond = stringToMillisecond.stringToMillisecond;
|
|
116
|
-
exports.toJSON = toJSON.toJSON;
|
|
117
|
-
exports.toTransform = toTransform.toTransform;
|
|
118
115
|
exports.toWrappedValue = toWrappedValue.toWrappedValue;
|
|
119
116
|
exports.unwrap = unwrap.unwrap;
|
|
120
117
|
exports.unwrapGroup = unwrapGroup.unwrapGroup;
|
|
@@ -125,7 +122,6 @@ exports.isRuntimeWrappedValueKey = wrapValue.isRuntimeWrappedValueKey;
|
|
|
125
122
|
exports.isWrappedValue = wrapValue.isWrappedValue;
|
|
126
123
|
exports.keyWrappedValue = wrapValue.keyWrappedValue;
|
|
127
124
|
exports.wrapValue = wrapValue.wrapValue;
|
|
128
|
-
exports.toString = toString.toString;
|
|
129
125
|
exports.innerPipe = innerPipe.innerPipe;
|
|
130
126
|
exports.asyncInnerPipe = asyncInnerPipe.asyncInnerPipe;
|
|
131
127
|
exports.loop = loop.loop;
|
|
@@ -161,3 +157,8 @@ Object.defineProperty(exports, "Path", {
|
|
|
161
157
|
enumerable: true,
|
|
162
158
|
get: function () { return path.Path; }
|
|
163
159
|
});
|
|
160
|
+
exports.createTransformer = transformer.createTransformer;
|
|
161
|
+
exports.toJSON = transformer.toJSON;
|
|
162
|
+
exports.toNative = transformer.toNative;
|
|
163
|
+
exports.transformer = transformer.transformer;
|
|
164
|
+
exports.toRegExp = toRegExp.toRegExp;
|
package/dist/index.mjs
CHANGED
|
@@ -49,15 +49,12 @@ export { sleep } from './common/sleep.mjs';
|
|
|
49
49
|
export { InvalidBytesInStringError, stringToBytes } from './common/stringToBytes.mjs';
|
|
50
50
|
export { mimeType } from './common/mimeType.mjs';
|
|
51
51
|
export { InvalidMillisecondInStringError, stringToMillisecond } from './common/stringToMillisecond.mjs';
|
|
52
|
-
export { toJSON } from './common/toJSON.mjs';
|
|
53
|
-
export { toTransform } from './common/toTransform.mjs';
|
|
54
52
|
export { toWrappedValue } from './common/toWrappedValue.mjs';
|
|
55
53
|
export { unwrap } from './common/unwrap.mjs';
|
|
56
54
|
export { unwrapGroup } from './common/unwrapGroup.mjs';
|
|
57
55
|
export { asyncLoop } from './common/asyncLoop.mjs';
|
|
58
56
|
export { createAsyncRetry, useAsyncRetry } from './common/asyncRetry.mjs';
|
|
59
57
|
export { isRuntimeWrappedValueKey, isWrappedValue, keyWrappedValue, wrapValue } from './common/wrapValue.mjs';
|
|
60
|
-
export { toString } from './common/toString.mjs';
|
|
61
58
|
export { innerPipe } from './common/innerPipe.mjs';
|
|
62
59
|
export { asyncInnerPipe } from './common/asyncInnerPipe.mjs';
|
|
63
60
|
export { loop } from './common/loop.mjs';
|
|
@@ -87,3 +84,5 @@ export { toCurriedPredicate } from './common/toCurriedPredicate.mjs';
|
|
|
87
84
|
export { pipeCall } from './common/pipeCall.mjs';
|
|
88
85
|
export { AssertsError, asserts } from './common/asserts.mjs';
|
|
89
86
|
export { Path } from './common/path.mjs';
|
|
87
|
+
export { createTransformer, toJSON, toNative, transformer } from './common/transformer.mjs';
|
|
88
|
+
export { toRegExp } from './common/toRegExp.mjs';
|
package/dist/metadata.json
CHANGED
|
@@ -612,6 +612,15 @@
|
|
|
612
612
|
},
|
|
613
613
|
{
|
|
614
614
|
"name": "string.mjs"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"name": "time.cjs"
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
"name": "time.d.ts"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"name": "time.mjs"
|
|
615
624
|
}
|
|
616
625
|
]
|
|
617
626
|
},
|
|
@@ -1551,40 +1560,31 @@
|
|
|
1551
1560
|
"name": "toCurriedPredicate.mjs"
|
|
1552
1561
|
},
|
|
1553
1562
|
{
|
|
1554
|
-
"name": "
|
|
1563
|
+
"name": "toRegExp.cjs"
|
|
1555
1564
|
},
|
|
1556
1565
|
{
|
|
1557
|
-
"name": "
|
|
1566
|
+
"name": "toRegExp.d.ts"
|
|
1558
1567
|
},
|
|
1559
1568
|
{
|
|
1560
|
-
"name": "
|
|
1569
|
+
"name": "toRegExp.mjs"
|
|
1561
1570
|
},
|
|
1562
1571
|
{
|
|
1563
|
-
"name": "
|
|
1564
|
-
},
|
|
1565
|
-
{
|
|
1566
|
-
"name": "toString.d.ts"
|
|
1567
|
-
},
|
|
1568
|
-
{
|
|
1569
|
-
"name": "toString.mjs"
|
|
1572
|
+
"name": "toWrappedValue.cjs"
|
|
1570
1573
|
},
|
|
1571
1574
|
{
|
|
1572
|
-
"name": "
|
|
1575
|
+
"name": "toWrappedValue.d.ts"
|
|
1573
1576
|
},
|
|
1574
1577
|
{
|
|
1575
|
-
"name": "
|
|
1578
|
+
"name": "toWrappedValue.mjs"
|
|
1576
1579
|
},
|
|
1577
1580
|
{
|
|
1578
|
-
"name": "
|
|
1581
|
+
"name": "transformer.cjs"
|
|
1579
1582
|
},
|
|
1580
1583
|
{
|
|
1581
|
-
"name": "
|
|
1584
|
+
"name": "transformer.d.ts"
|
|
1582
1585
|
},
|
|
1583
1586
|
{
|
|
1584
|
-
"name": "
|
|
1585
|
-
},
|
|
1586
|
-
{
|
|
1587
|
-
"name": "toWrappedValue.mjs"
|
|
1587
|
+
"name": "transformer.mjs"
|
|
1588
1588
|
},
|
|
1589
1589
|
{
|
|
1590
1590
|
"name": "truthy.cjs"
|
|
@@ -3032,16 +3032,16 @@
|
|
|
3032
3032
|
"name": "month.d.ts"
|
|
3033
3033
|
},
|
|
3034
3034
|
{
|
|
3035
|
-
"name": "
|
|
3035
|
+
"name": "serializedTheDate.d.ts"
|
|
3036
3036
|
},
|
|
3037
3037
|
{
|
|
3038
|
-
"name": "
|
|
3038
|
+
"name": "serializedTheTime.d.ts"
|
|
3039
3039
|
},
|
|
3040
3040
|
{
|
|
3041
|
-
"name": "
|
|
3041
|
+
"name": "spoolingDate.d.ts"
|
|
3042
3042
|
},
|
|
3043
3043
|
{
|
|
3044
|
-
"name": "
|
|
3044
|
+
"name": "spoolingTime.d.ts"
|
|
3045
3045
|
},
|
|
3046
3046
|
{
|
|
3047
3047
|
"name": "time.d.ts"
|
|
@@ -3096,24 +3096,6 @@
|
|
|
3096
3096
|
{
|
|
3097
3097
|
"name": "createOrThrow.mjs"
|
|
3098
3098
|
},
|
|
3099
|
-
{
|
|
3100
|
-
"name": "createTheDate.cjs"
|
|
3101
|
-
},
|
|
3102
|
-
{
|
|
3103
|
-
"name": "createTheDate.d.ts"
|
|
3104
|
-
},
|
|
3105
|
-
{
|
|
3106
|
-
"name": "createTheDate.mjs"
|
|
3107
|
-
},
|
|
3108
|
-
{
|
|
3109
|
-
"name": "createTheTime.cjs"
|
|
3110
|
-
},
|
|
3111
|
-
{
|
|
3112
|
-
"name": "createTheTime.d.ts"
|
|
3113
|
-
},
|
|
3114
|
-
{
|
|
3115
|
-
"name": "createTheTime.mjs"
|
|
3116
|
-
},
|
|
3117
3099
|
{
|
|
3118
3100
|
"name": "createTime.cjs"
|
|
3119
3101
|
},
|
|
@@ -3204,6 +3186,24 @@
|
|
|
3204
3186
|
{
|
|
3205
3187
|
"name": "isSafeTimeValue.mjs"
|
|
3206
3188
|
},
|
|
3189
|
+
{
|
|
3190
|
+
"name": "isSerializedTheDate.cjs"
|
|
3191
|
+
},
|
|
3192
|
+
{
|
|
3193
|
+
"name": "isSerializedTheDate.d.ts"
|
|
3194
|
+
},
|
|
3195
|
+
{
|
|
3196
|
+
"name": "isSerializedTheDate.mjs"
|
|
3197
|
+
},
|
|
3198
|
+
{
|
|
3199
|
+
"name": "isSerializedTheTime.cjs"
|
|
3200
|
+
},
|
|
3201
|
+
{
|
|
3202
|
+
"name": "isSerializedTheTime.d.ts"
|
|
3203
|
+
},
|
|
3204
|
+
{
|
|
3205
|
+
"name": "isSerializedTheTime.mjs"
|
|
3206
|
+
},
|
|
3207
3207
|
{
|
|
3208
3208
|
"name": "isTime.cjs"
|
|
3209
3209
|
},
|
|
@@ -3213,6 +3213,15 @@
|
|
|
3213
3213
|
{
|
|
3214
3214
|
"name": "isTime.mjs"
|
|
3215
3215
|
},
|
|
3216
|
+
{
|
|
3217
|
+
"name": "kind.cjs"
|
|
3218
|
+
},
|
|
3219
|
+
{
|
|
3220
|
+
"name": "kind.d.ts"
|
|
3221
|
+
},
|
|
3222
|
+
{
|
|
3223
|
+
"name": "kind.mjs"
|
|
3224
|
+
},
|
|
3216
3225
|
{
|
|
3217
3226
|
"name": "makeSafeTimestamp.cjs"
|
|
3218
3227
|
},
|
|
@@ -3285,6 +3294,15 @@
|
|
|
3285
3294
|
{
|
|
3286
3295
|
"name": "round.mjs"
|
|
3287
3296
|
},
|
|
3297
|
+
{
|
|
3298
|
+
"name": "serialize.cjs"
|
|
3299
|
+
},
|
|
3300
|
+
{
|
|
3301
|
+
"name": "serialize.d.ts"
|
|
3302
|
+
},
|
|
3303
|
+
{
|
|
3304
|
+
"name": "serialize.mjs"
|
|
3305
|
+
},
|
|
3288
3306
|
{
|
|
3289
3307
|
"name": "sort.cjs"
|
|
3290
3308
|
},
|
|
@@ -3303,6 +3321,24 @@
|
|
|
3303
3321
|
{
|
|
3304
3322
|
"name": "sortTimes.mjs"
|
|
3305
3323
|
},
|
|
3324
|
+
{
|
|
3325
|
+
"name": "theDate.cjs"
|
|
3326
|
+
},
|
|
3327
|
+
{
|
|
3328
|
+
"name": "theDate.d.ts"
|
|
3329
|
+
},
|
|
3330
|
+
{
|
|
3331
|
+
"name": "theDate.mjs"
|
|
3332
|
+
},
|
|
3333
|
+
{
|
|
3334
|
+
"name": "theTime.cjs"
|
|
3335
|
+
},
|
|
3336
|
+
{
|
|
3337
|
+
"name": "theTime.d.ts"
|
|
3338
|
+
},
|
|
3339
|
+
{
|
|
3340
|
+
"name": "theTime.mjs"
|
|
3341
|
+
},
|
|
3306
3342
|
{
|
|
3307
3343
|
"name": "timezone.cjs"
|
|
3308
3344
|
},
|
|
@@ -3813,6 +3849,15 @@
|
|
|
3813
3849
|
{
|
|
3814
3850
|
"name": "asyncFilter.mjs"
|
|
3815
3851
|
},
|
|
3852
|
+
{
|
|
3853
|
+
"name": "asyncGroup.cjs"
|
|
3854
|
+
},
|
|
3855
|
+
{
|
|
3856
|
+
"name": "asyncGroup.d.ts"
|
|
3857
|
+
},
|
|
3858
|
+
{
|
|
3859
|
+
"name": "asyncGroup.mjs"
|
|
3860
|
+
},
|
|
3816
3861
|
{
|
|
3817
3862
|
"name": "asyncLoop.cjs"
|
|
3818
3863
|
},
|
|
@@ -3867,6 +3912,15 @@
|
|
|
3867
3912
|
{
|
|
3868
3913
|
"name": "filter.mjs"
|
|
3869
3914
|
},
|
|
3915
|
+
{
|
|
3916
|
+
"name": "group.cjs"
|
|
3917
|
+
},
|
|
3918
|
+
{
|
|
3919
|
+
"name": "group.d.ts"
|
|
3920
|
+
},
|
|
3921
|
+
{
|
|
3922
|
+
"name": "group.mjs"
|
|
3923
|
+
},
|
|
3870
3924
|
{
|
|
3871
3925
|
"name": "index.cjs"
|
|
3872
3926
|
},
|
package/dist/object/entries.cjs
CHANGED
|
@@ -7,8 +7,13 @@ var kind = require('../common/kind.cjs');
|
|
|
7
7
|
* {@include object/entries/index.md}
|
|
8
8
|
*/
|
|
9
9
|
function entries(object) {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const result = [];
|
|
11
|
+
for (const key in object) {
|
|
12
|
+
if (!wrapValue.isRuntimeWrappedValueKey(key) && !kind.isRuntimeKind(key)) {
|
|
13
|
+
result.push([key, object[key]]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* @deprecated Not ignore kind key.
|
package/dist/object/entries.mjs
CHANGED
|
@@ -5,8 +5,13 @@ import { isRuntimeKind } from '../common/kind.mjs';
|
|
|
5
5
|
* {@include object/entries/index.md}
|
|
6
6
|
*/
|
|
7
7
|
function entries(object) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const result = [];
|
|
9
|
+
for (const key in object) {
|
|
10
|
+
if (!isRuntimeWrappedValueKey(key) && !isRuntimeKind(key)) {
|
|
11
|
+
result.push([key, object[key]]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
10
15
|
}
|
|
11
16
|
/**
|
|
12
17
|
* @deprecated Not ignore kind key.
|
package/dist/object/keys.cjs
CHANGED
|
@@ -7,8 +7,13 @@ var kind = require('../common/kind.cjs');
|
|
|
7
7
|
* {@include object/keys/index.md}
|
|
8
8
|
*/
|
|
9
9
|
function keys(object) {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const result = [];
|
|
11
|
+
for (const key in object) {
|
|
12
|
+
if (!wrapValue.isRuntimeWrappedValueKey(key) && !kind.isRuntimeKind(key)) {
|
|
13
|
+
result.push(key);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
exports.keys = keys;
|
package/dist/object/keys.d.ts
CHANGED
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
* @namespace O
|
|
32
32
|
*
|
|
33
33
|
*/
|
|
34
|
-
export declare function keys<GenericObject extends object>(object: GenericObject): (Exclude<keyof GenericObject, symbol>)[];
|
|
34
|
+
export declare function keys<GenericObject extends object>(object: GenericObject): (`${Exclude<keyof GenericObject, symbol>}`)[];
|
package/dist/object/keys.mjs
CHANGED
|
@@ -5,8 +5,13 @@ import { isRuntimeKind } from '../common/kind.mjs';
|
|
|
5
5
|
* {@include object/keys/index.md}
|
|
6
6
|
*/
|
|
7
7
|
function keys(object) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const result = [];
|
|
9
|
+
for (const key in object) {
|
|
10
|
+
if (!isRuntimeWrappedValueKey(key) && !isRuntimeKind(key)) {
|
|
11
|
+
result.push(key);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
export { keys };
|