@duplojs/utils 1.4.58 → 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/common/index.d.ts +2 -1
- 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/dataParser/error.cjs +4 -2
- package/dist/dataParser/error.d.ts +4 -2
- package/dist/dataParser/error.mjs +4 -2
- 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 +2 -0
- package/dist/index.mjs +1 -0
- package/dist/metadata.json +27 -0
- 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/array/group.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var reduce = require('./reduce.cjs');
|
|
4
|
-
|
|
5
3
|
function groupOutput(...args) {
|
|
6
4
|
if (args.length === 1) {
|
|
7
5
|
const [group] = args;
|
|
@@ -19,18 +17,20 @@ function group(...args) {
|
|
|
19
17
|
return (array) => group(array, theFunction);
|
|
20
18
|
}
|
|
21
19
|
const [array, theFunction] = args;
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const result = {};
|
|
21
|
+
for (let index = 0; index < array.length; index++) {
|
|
22
|
+
const { group, value } = theFunction(array[index], {
|
|
24
23
|
index,
|
|
25
24
|
output: groupOutput,
|
|
26
25
|
});
|
|
27
|
-
|
|
28
|
-
[group]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
26
|
+
if (result[group]) {
|
|
27
|
+
result[group].push(value);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
result[group] = [value];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
exports.group = group;
|
package/dist/array/group.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SimplifyTopLevel } from "../common/types/simplifyTopLevel";
|
|
2
2
|
export interface ArrayGroupFunctionOutput<GenericGroupName extends string = string, GenericGroupValue extends unknown = unknown> {
|
|
3
3
|
group: GenericGroupName;
|
|
4
4
|
value: GenericGroupValue;
|
package/dist/array/group.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { reduce, reduceFrom } from './reduce.mjs';
|
|
2
|
-
|
|
3
1
|
function groupOutput(...args) {
|
|
4
2
|
if (args.length === 1) {
|
|
5
3
|
const [group] = args;
|
|
@@ -17,18 +15,20 @@ function group(...args) {
|
|
|
17
15
|
return (array) => group(array, theFunction);
|
|
18
16
|
}
|
|
19
17
|
const [array, theFunction] = args;
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const result = {};
|
|
19
|
+
for (let index = 0; index < array.length; index++) {
|
|
20
|
+
const { group, value } = theFunction(array[index], {
|
|
22
21
|
index,
|
|
23
22
|
output: groupOutput,
|
|
24
23
|
});
|
|
25
|
-
|
|
26
|
-
[group]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
24
|
+
if (result[group]) {
|
|
25
|
+
result[group].push(value);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
result[group] = [value];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export { group, groupOutput };
|
package/dist/common/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - predicates and guards (`when`, `whenNot`, `whenElse`, `and`, `or`, `isType`, `asserts`, `instanceOf`)
|
|
17
17
|
* - control flow (`loop`, `asyncLoop`, `asyncRetry`, `sleep`, `memo`)
|
|
18
18
|
* - promise utilities (`externalPromise`, `promiseObject`)
|
|
19
|
-
* - string and value conversions (`stringToMillisecond`, `stringToBytes`, `escapeRegExp`)
|
|
19
|
+
* - string and value conversions (`stringToMillisecond`, `stringToBytes`, `escapeRegExp`, `toRegExp`)
|
|
20
20
|
* - wrappers and kinds (`wrapValue`, `unwrap`, `toWrappedValue`, `hasKinds`, `hasSomeKinds`)
|
|
21
21
|
*
|
|
22
22
|
* @see https://utils.duplojs.dev/en/v1/api/common
|
|
@@ -74,3 +74,4 @@ export * from "./pipeCall";
|
|
|
74
74
|
export * from "./asserts";
|
|
75
75
|
export * from "./path";
|
|
76
76
|
export * from "./transformer";
|
|
77
|
+
export * from "./toRegExp";
|
package/dist/common/path.cjs
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var success = require('../either/right/success.cjs');
|
|
4
|
-
var fail = require('../either/left/fail.cjs');
|
|
5
|
-
|
|
6
3
|
exports.Path = void 0;
|
|
7
4
|
(function (Path) {
|
|
8
5
|
Path.baseNameRegex = /\/?([^/]+)$/;
|
|
9
6
|
Path.folderNameRegex = /([^]+)\/[^/]+\/?$/;
|
|
10
7
|
Path.extensionNameRegex = /\.([^./]+)$/;
|
|
11
|
-
Path.
|
|
8
|
+
Path.isContainBackPathRegex = /(^|\/)\.\.(?=\/|$)/;
|
|
12
9
|
Path.segmentTrailingRegex = /\/$/;
|
|
13
10
|
Path.segmentRelativeRegex = /^(.\/)/;
|
|
14
11
|
/**
|
|
@@ -52,17 +49,21 @@ exports.Path = void 0;
|
|
|
52
49
|
*/
|
|
53
50
|
function isAbsolute(path) {
|
|
54
51
|
return path.startsWith("/")
|
|
55
|
-
&& !Path.
|
|
52
|
+
&& !Path.isContainBackPathRegex.test(path);
|
|
56
53
|
}
|
|
57
54
|
Path.isAbsolute = isAbsolute;
|
|
58
55
|
/**
|
|
59
56
|
* {@include common/path/resolveFrom/index.md}
|
|
60
57
|
*/
|
|
61
|
-
function resolveFrom(origin, segments) {
|
|
62
|
-
const
|
|
58
|
+
function resolveFrom(origin, segments, params) {
|
|
59
|
+
const resultRelative = resolveRelative(segments);
|
|
60
|
+
if (params?.stayInOrigin && resultRelative.startsWith("../")) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const result = resolveRelative([origin, resultRelative]);
|
|
63
64
|
return isAbsolute(result)
|
|
64
|
-
?
|
|
65
|
-
:
|
|
65
|
+
? result
|
|
66
|
+
: null;
|
|
66
67
|
}
|
|
67
68
|
Path.resolveFrom = resolveFrom;
|
|
68
69
|
/**
|
|
@@ -74,16 +75,15 @@ exports.Path = void 0;
|
|
|
74
75
|
if (segment.length === 0) {
|
|
75
76
|
continue;
|
|
76
77
|
}
|
|
77
|
-
if (segment === "/") {
|
|
78
|
+
else if (segment === "/") {
|
|
78
79
|
clearedPath = segment;
|
|
79
80
|
continue;
|
|
80
81
|
}
|
|
81
82
|
const formattedSegment = fix(segment);
|
|
82
|
-
if (formattedSegment.startsWith("/")) {
|
|
83
|
+
if (formattedSegment.startsWith("/") || clearedPath === "") {
|
|
83
84
|
clearedPath = formattedSegment;
|
|
84
|
-
continue;
|
|
85
85
|
}
|
|
86
|
-
if (clearedPath === "/") {
|
|
86
|
+
else if (clearedPath === "/") {
|
|
87
87
|
clearedPath += formattedSegment;
|
|
88
88
|
}
|
|
89
89
|
else {
|
package/dist/common/path.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import * as DEither from "../either";
|
|
2
1
|
import type { AnyTuple } from "./types";
|
|
3
2
|
export declare namespace Path {
|
|
4
3
|
const baseNameRegex: RegExp;
|
|
5
4
|
const folderNameRegex: RegExp;
|
|
6
5
|
const extensionNameRegex: RegExp;
|
|
7
|
-
const
|
|
6
|
+
const isContainBackPathRegex: RegExp;
|
|
8
7
|
const segmentTrailingRegex: RegExp;
|
|
9
8
|
const segmentRelativeRegex: RegExp;
|
|
10
9
|
interface GetBaseNameParams {
|
|
@@ -95,31 +94,38 @@ export declare namespace Path {
|
|
|
95
94
|
*
|
|
96
95
|
*/
|
|
97
96
|
function isAbsolute<GenericPath extends string>(path: GenericPath): boolean;
|
|
97
|
+
interface ResolveFromParams {
|
|
98
|
+
stayInOrigin?: boolean;
|
|
99
|
+
}
|
|
98
100
|
/**
|
|
99
|
-
* Resolves a list of path segments from an origin
|
|
101
|
+
* Resolves a list of path segments from an origin.
|
|
100
102
|
*
|
|
101
103
|
* **Supported call styles:**
|
|
102
|
-
* - Classic: `resolveFrom(origin, segments)` -> returns
|
|
104
|
+
* - Classic: `resolveFrom(origin, segments, params?)` -> returns the resolved absolute path or null
|
|
103
105
|
*
|
|
104
106
|
* Segments are resolved in order using `resolveRelative`.
|
|
105
|
-
* The
|
|
107
|
+
* The function returns `null` when the final path is not absolute.
|
|
108
|
+
* When `params.stayInOrigin` is `true`, the resolution returns `null` if segments escape the origin with leading `../`.
|
|
106
109
|
*
|
|
107
110
|
* ```ts
|
|
108
111
|
* const absoluteResult = Path.resolveFrom("/root", ["alpha", "beta"]);
|
|
109
|
-
* // absoluteResult:
|
|
110
|
-
* const result = unwrap(absoluteResult);
|
|
111
|
-
* // result: "/root/alpha/beta"
|
|
112
|
+
* // absoluteResult: "/root/alpha/beta"
|
|
112
113
|
*
|
|
113
114
|
* const overrideResult = Path.resolveFrom("gamma", ["alpha", "/root", "beta"]);
|
|
114
|
-
* // overrideResult:
|
|
115
|
+
* // overrideResult: "/root/beta"
|
|
116
|
+
*
|
|
115
117
|
* const relativeResult = Path.resolveFrom("alpha", ["..", ".."]);
|
|
116
|
-
* // relativeResult:
|
|
118
|
+
* // relativeResult: null
|
|
119
|
+
*
|
|
120
|
+
* const blockedResult = Path.resolveFrom("/root", ["..", "etc"], {
|
|
121
|
+
* stayInOrigin: true,
|
|
122
|
+
* });
|
|
117
123
|
* ```
|
|
118
124
|
*
|
|
119
125
|
* @see https://utils.duplojs.dev/en/v1/api/common/path/resolveFrom
|
|
120
126
|
*
|
|
121
127
|
*/
|
|
122
|
-
function resolveFrom<GenericSegment extends string>(origin: string, segments: AnyTuple<GenericSegment
|
|
128
|
+
function resolveFrom<GenericSegment extends string>(origin: string, segments: AnyTuple<GenericSegment>, params?: ResolveFromParams): string | null;
|
|
123
129
|
/**
|
|
124
130
|
* Resolves path segments into a single POSIX-like path.
|
|
125
131
|
*
|
package/dist/common/path.mjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { success } from '../either/right/success.mjs';
|
|
2
|
-
import { fail } from '../either/left/fail.mjs';
|
|
3
|
-
|
|
4
1
|
var Path;
|
|
5
2
|
(function (Path) {
|
|
6
3
|
Path.baseNameRegex = /\/?([^/]+)$/;
|
|
7
4
|
Path.folderNameRegex = /([^]+)\/[^/]+\/?$/;
|
|
8
5
|
Path.extensionNameRegex = /\.([^./]+)$/;
|
|
9
|
-
Path.
|
|
6
|
+
Path.isContainBackPathRegex = /(^|\/)\.\.(?=\/|$)/;
|
|
10
7
|
Path.segmentTrailingRegex = /\/$/;
|
|
11
8
|
Path.segmentRelativeRegex = /^(.\/)/;
|
|
12
9
|
/**
|
|
@@ -50,17 +47,21 @@ var Path;
|
|
|
50
47
|
*/
|
|
51
48
|
function isAbsolute(path) {
|
|
52
49
|
return path.startsWith("/")
|
|
53
|
-
&& !Path.
|
|
50
|
+
&& !Path.isContainBackPathRegex.test(path);
|
|
54
51
|
}
|
|
55
52
|
Path.isAbsolute = isAbsolute;
|
|
56
53
|
/**
|
|
57
54
|
* {@include common/path/resolveFrom/index.md}
|
|
58
55
|
*/
|
|
59
|
-
function resolveFrom(origin, segments) {
|
|
60
|
-
const
|
|
56
|
+
function resolveFrom(origin, segments, params) {
|
|
57
|
+
const resultRelative = resolveRelative(segments);
|
|
58
|
+
if (params?.stayInOrigin && resultRelative.startsWith("../")) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const result = resolveRelative([origin, resultRelative]);
|
|
61
62
|
return isAbsolute(result)
|
|
62
|
-
?
|
|
63
|
-
:
|
|
63
|
+
? result
|
|
64
|
+
: null;
|
|
64
65
|
}
|
|
65
66
|
Path.resolveFrom = resolveFrom;
|
|
66
67
|
/**
|
|
@@ -72,16 +73,15 @@ var Path;
|
|
|
72
73
|
if (segment.length === 0) {
|
|
73
74
|
continue;
|
|
74
75
|
}
|
|
75
|
-
if (segment === "/") {
|
|
76
|
+
else if (segment === "/") {
|
|
76
77
|
clearedPath = segment;
|
|
77
78
|
continue;
|
|
78
79
|
}
|
|
79
80
|
const formattedSegment = fix(segment);
|
|
80
|
-
if (formattedSegment.startsWith("/")) {
|
|
81
|
+
if (formattedSegment.startsWith("/") || clearedPath === "") {
|
|
81
82
|
clearedPath = formattedSegment;
|
|
82
|
-
continue;
|
|
83
83
|
}
|
|
84
|
-
if (clearedPath === "/") {
|
|
84
|
+
else if (clearedPath === "/") {
|
|
85
85
|
clearedPath += formattedSegment;
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var escapeRegExp = require('./escapeRegExp.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* {@include common/toRegExp/index.md}
|
|
7
|
+
*/
|
|
8
|
+
function toRegExp(input) {
|
|
9
|
+
if (typeof input === "string") {
|
|
10
|
+
return new RegExp(`^${escapeRegExp.escapeRegExp(input)}$`);
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(input)) {
|
|
13
|
+
const result = input.map(escapeRegExp.escapeRegExp).join("|");
|
|
14
|
+
return new RegExp(`^(?:${result})$`);
|
|
15
|
+
}
|
|
16
|
+
return input;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.toRegExp = toRegExp;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toRegExp() function normalizes a value into a regular expression. Strings and string arrays are escaped and converted to exact-match regex patterns.
|
|
3
|
+
*
|
|
4
|
+
* Supported call style:
|
|
5
|
+
* - Classic: `toRegExp(input)` → returns a value
|
|
6
|
+
*
|
|
7
|
+
* Behavior:
|
|
8
|
+
* - `string` input becomes an exact regex (`^.../**
|
|
9
|
+
)
|
|
10
|
+
* - `string[]` input becomes an exact alternation regex (`^(?:...|...)/**
|
|
11
|
+
)
|
|
12
|
+
* - `RegExp` input is returned as-is
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const fromString = toRegExp("a.c");
|
|
16
|
+
* // matches only the literal "a.c"
|
|
17
|
+
*
|
|
18
|
+
* const fromList = toRegExp([
|
|
19
|
+
* "jpg",
|
|
20
|
+
* "png",
|
|
21
|
+
* ]);
|
|
22
|
+
* // matches "jpg" or "png"
|
|
23
|
+
*
|
|
24
|
+
* const existing = /hello/i;
|
|
25
|
+
* const sameInstance = toRegExp(existing);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @see https://utils.duplojs.dev/en/v1/api/common/toRegExp
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare function toRegExp(input: string | string[] | RegExp): RegExp;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { escapeRegExp } from './escapeRegExp.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* {@include common/toRegExp/index.md}
|
|
5
|
+
*/
|
|
6
|
+
function toRegExp(input) {
|
|
7
|
+
if (typeof input === "string") {
|
|
8
|
+
return new RegExp(`^${escapeRegExp(input)}$`);
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(input)) {
|
|
11
|
+
const result = input.map(escapeRegExp).join("|");
|
|
12
|
+
return new RegExp(`^(?:${result})$`);
|
|
13
|
+
}
|
|
14
|
+
return input;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { toRegExp };
|
|
@@ -15,19 +15,21 @@ function createError() {
|
|
|
15
15
|
currentPath: [],
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function addIssue(error, source, data) {
|
|
18
|
+
function addIssue(error, source, data, moreInformation) {
|
|
19
19
|
error.issues.push(errorIssueKind.setTo({
|
|
20
20
|
source,
|
|
21
21
|
path: error.currentPath.join("."),
|
|
22
22
|
data,
|
|
23
|
+
moreInformation,
|
|
23
24
|
}));
|
|
24
25
|
return error;
|
|
25
26
|
}
|
|
26
|
-
function addPromiseIssue(error, source, data) {
|
|
27
|
+
function addPromiseIssue(error, source, data, moreInformation) {
|
|
27
28
|
error.issues.push(errorPromiseIssueKind.setTo({
|
|
28
29
|
source,
|
|
29
30
|
path: error.currentPath.join("."),
|
|
30
31
|
data,
|
|
32
|
+
moreInformation,
|
|
31
33
|
}));
|
|
32
34
|
return error;
|
|
33
35
|
}
|
|
@@ -10,6 +10,7 @@ export interface DataParserErrorIssue extends Kind<typeof errorIssueKind.definit
|
|
|
10
10
|
readonly source: DataParser | DataParserCheckers;
|
|
11
11
|
readonly path: string;
|
|
12
12
|
readonly data: unknown;
|
|
13
|
+
readonly moreInformation?: string;
|
|
13
14
|
}
|
|
14
15
|
export declare const SymbolDataParserErrorPromiseIssueLabel = "SymbolDataParserErrorPromiseIssue";
|
|
15
16
|
export declare const SymbolDataParserErrorPromiseIssue: unique symbol;
|
|
@@ -19,6 +20,7 @@ export interface DataParserErrorPromiseIssue extends Kind<typeof errorPromiseIss
|
|
|
19
20
|
readonly source: DataParserTransform;
|
|
20
21
|
readonly path: string;
|
|
21
22
|
readonly data: unknown;
|
|
23
|
+
readonly moreInformation?: string;
|
|
22
24
|
}
|
|
23
25
|
export declare const errorKind: import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsDataParser/error", unknown>>;
|
|
24
26
|
export interface DataParserError extends Kind<typeof errorKind.definition> {
|
|
@@ -26,7 +28,7 @@ export interface DataParserError extends Kind<typeof errorKind.definition> {
|
|
|
26
28
|
readonly currentPath: string[];
|
|
27
29
|
}
|
|
28
30
|
export declare function createError(): DataParserError;
|
|
29
|
-
export declare function addIssue(error: DataParserError, source: DataParser | DataParserCheckers, data: unknown): DataParserError;
|
|
30
|
-
export declare function addPromiseIssue(error: DataParserError, source: DataParserTransform, data: unknown): DataParserError;
|
|
31
|
+
export declare function addIssue(error: DataParserError, source: DataParser | DataParserCheckers, data: unknown, moreInformation?: string): DataParserError;
|
|
32
|
+
export declare function addPromiseIssue(error: DataParserError, source: DataParserTransform, data: unknown, moreInformation?: string): DataParserError;
|
|
31
33
|
export declare function setErrorPath(error: DataParserError, value: string, index: number): DataParserError;
|
|
32
34
|
export declare function popErrorPath(error: DataParserError): DataParserError;
|
|
@@ -13,19 +13,21 @@ function createError() {
|
|
|
13
13
|
currentPath: [],
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
function addIssue(error, source, data) {
|
|
16
|
+
function addIssue(error, source, data, moreInformation) {
|
|
17
17
|
error.issues.push(errorIssueKind.setTo({
|
|
18
18
|
source,
|
|
19
19
|
path: error.currentPath.join("."),
|
|
20
20
|
data,
|
|
21
|
+
moreInformation,
|
|
21
22
|
}));
|
|
22
23
|
return error;
|
|
23
24
|
}
|
|
24
|
-
function addPromiseIssue(error, source, data) {
|
|
25
|
+
function addPromiseIssue(error, source, data, moreInformation) {
|
|
25
26
|
error.issues.push(errorPromiseIssueKind.setTo({
|
|
26
27
|
source,
|
|
27
28
|
path: error.currentPath.join("."),
|
|
28
29
|
data,
|
|
30
|
+
moreInformation,
|
|
29
31
|
}));
|
|
30
32
|
return error;
|
|
31
33
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var group = require('./group.cjs');
|
|
4
|
+
|
|
5
|
+
function asyncGroup(...args) {
|
|
6
|
+
if (args.length === 1) {
|
|
7
|
+
const [theFunction] = args;
|
|
8
|
+
return (asyncIterator) => asyncGroup(asyncIterator, theFunction);
|
|
9
|
+
}
|
|
10
|
+
const [asyncIterator, theFunction] = args;
|
|
11
|
+
const result = {};
|
|
12
|
+
let index = 0;
|
|
13
|
+
return (async () => {
|
|
14
|
+
for await (const element of asyncIterator) {
|
|
15
|
+
const { group: group$1, value } = await theFunction(element, {
|
|
16
|
+
index,
|
|
17
|
+
output: group.groupOutput,
|
|
18
|
+
});
|
|
19
|
+
if (result[group$1]) {
|
|
20
|
+
result[group$1].push(value);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
result[group$1] = [value];
|
|
24
|
+
}
|
|
25
|
+
index++;
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
})();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.asyncGroup = asyncGroup;
|
|
@@ -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
|
@@ -63,6 +63,7 @@ var pipeCall = require('./common/pipeCall.cjs');
|
|
|
63
63
|
var asserts = require('./common/asserts.cjs');
|
|
64
64
|
var path = require('./common/path.cjs');
|
|
65
65
|
var transformer = require('./common/transformer.cjs');
|
|
66
|
+
var toRegExp = require('./common/toRegExp.cjs');
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
|
|
@@ -160,3 +161,4 @@ exports.createTransformer = transformer.createTransformer;
|
|
|
160
161
|
exports.toJSON = transformer.toJSON;
|
|
161
162
|
exports.toNative = transformer.toNative;
|
|
162
163
|
exports.transformer = transformer.transformer;
|
|
164
|
+
exports.toRegExp = toRegExp.toRegExp;
|
package/dist/index.mjs
CHANGED
|
@@ -85,3 +85,4 @@ export { pipeCall } from './common/pipeCall.mjs';
|
|
|
85
85
|
export { AssertsError, asserts } from './common/asserts.mjs';
|
|
86
86
|
export { Path } from './common/path.mjs';
|
|
87
87
|
export { createTransformer, toJSON, toNative, transformer } from './common/transformer.mjs';
|
|
88
|
+
export { toRegExp } from './common/toRegExp.mjs';
|
package/dist/metadata.json
CHANGED
|
@@ -1559,6 +1559,15 @@
|
|
|
1559
1559
|
{
|
|
1560
1560
|
"name": "toCurriedPredicate.mjs"
|
|
1561
1561
|
},
|
|
1562
|
+
{
|
|
1563
|
+
"name": "toRegExp.cjs"
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
"name": "toRegExp.d.ts"
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
"name": "toRegExp.mjs"
|
|
1570
|
+
},
|
|
1562
1571
|
{
|
|
1563
1572
|
"name": "toWrappedValue.cjs"
|
|
1564
1573
|
},
|
|
@@ -3840,6 +3849,15 @@
|
|
|
3840
3849
|
{
|
|
3841
3850
|
"name": "asyncFilter.mjs"
|
|
3842
3851
|
},
|
|
3852
|
+
{
|
|
3853
|
+
"name": "asyncGroup.cjs"
|
|
3854
|
+
},
|
|
3855
|
+
{
|
|
3856
|
+
"name": "asyncGroup.d.ts"
|
|
3857
|
+
},
|
|
3858
|
+
{
|
|
3859
|
+
"name": "asyncGroup.mjs"
|
|
3860
|
+
},
|
|
3843
3861
|
{
|
|
3844
3862
|
"name": "asyncLoop.cjs"
|
|
3845
3863
|
},
|
|
@@ -3894,6 +3912,15 @@
|
|
|
3894
3912
|
{
|
|
3895
3913
|
"name": "filter.mjs"
|
|
3896
3914
|
},
|
|
3915
|
+
{
|
|
3916
|
+
"name": "group.cjs"
|
|
3917
|
+
},
|
|
3918
|
+
{
|
|
3919
|
+
"name": "group.d.ts"
|
|
3920
|
+
},
|
|
3921
|
+
{
|
|
3922
|
+
"name": "group.mjs"
|
|
3923
|
+
},
|
|
3897
3924
|
{
|
|
3898
3925
|
"name": "index.cjs"
|
|
3899
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 };
|