@forklaunch/common 0.1.14 → 0.2.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/lib/index.d.mts +64 -0
- package/lib/index.d.ts +64 -8
- package/lib/index.js +71 -7
- package/lib/index.mjs +42 -0
- package/package.json +14 -11
- package/lib/guards/isNever.d.ts +0 -2
- package/lib/guards/isNever.d.ts.map +0 -1
- package/lib/guards/isNever.js +0 -3
- package/lib/guards/isRecord.d.ts +0 -8
- package/lib/guards/isRecord.d.ts.map +0 -1
- package/lib/guards/isRecord.js +0 -9
- package/lib/index.d.ts.map +0 -1
- package/lib/types/flatten.types.d.ts +0 -27
- package/lib/types/flatten.types.d.ts.map +0 -1
- package/lib/types/flatten.types.js +0 -1
- package/lib/types/makePropertyOptionalIfChildrenOptional.types.d.ts +0 -8
- package/lib/types/makePropertyOptionalIfChildrenOptional.types.d.ts.map +0 -1
- package/lib/types/makePropertyOptionalIfChildrenOptional.types.js +0 -1
- package/lib/types/prettify.types.d.ts +0 -13
- package/lib/types/prettify.types.d.ts.map +0 -1
- package/lib/types/prettify.types.js +0 -1
- package/lib/types/removeTrailingSlash.types.d.ts +0 -2
- package/lib/types/removeTrailingSlash.types.d.ts.map +0 -1
- package/lib/types/removeTrailingSlash.types.js +0 -1
- package/lib/utils/extractArgumentNames.d.ts +0 -4
- package/lib/utils/extractArgumentNames.d.ts.map +0 -1
- package/lib/utils/extractArgumentNames.js +0 -30
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
declare function isNever(value: never): value is never;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if the given object is a record.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} obj - The object to check.
|
|
7
|
+
* @returns {boolean} - True if the object is a record, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
declare function isRecord(obj: unknown): obj is Record<string, unknown>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A type that represents the values of an object type `T`.
|
|
13
|
+
*
|
|
14
|
+
* This utility type takes an object type `T` and produces a union of its value types.
|
|
15
|
+
*
|
|
16
|
+
* @template T - The object type to extract values from.
|
|
17
|
+
*/
|
|
18
|
+
type FlattenValues<T> = T[keyof T];
|
|
19
|
+
/**
|
|
20
|
+
* A type that represents the keys of an object type `T`.
|
|
21
|
+
*
|
|
22
|
+
* This utility type takes an object type `T` and produces a union of its key types.
|
|
23
|
+
*
|
|
24
|
+
* @template T - The object type to extract keys from.
|
|
25
|
+
*/
|
|
26
|
+
type FlattenKeys<T> = keyof T;
|
|
27
|
+
/**
|
|
28
|
+
* A type that flattens an object type `T`.
|
|
29
|
+
*
|
|
30
|
+
* This utility type takes an object type `T` and recursively flattens it.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The object type to flatten.
|
|
33
|
+
*/
|
|
34
|
+
type Flatten<T> = T extends object ? {
|
|
35
|
+
[K in keyof T]: Flatten<T[K]>;
|
|
36
|
+
} : T;
|
|
37
|
+
|
|
38
|
+
type AllPropertiesOptional<T> = T extends Partial<T> ? (Partial<T> extends T ? true : false) : false;
|
|
39
|
+
type MakePropertyOptionalIfChildrenOptional<T> = {
|
|
40
|
+
[K in keyof T as AllPropertiesOptional<T[K]> extends true ? K : never]?: T[K];
|
|
41
|
+
} & {
|
|
42
|
+
[K in keyof T as AllPropertiesOptional<T[K]> extends true ? never : K]: T[K];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A type that "prettifies" the structure of an object type `T`.
|
|
47
|
+
*
|
|
48
|
+
* This utility type takes an object type `T` and re-maps its keys and values, effectively creating
|
|
49
|
+
* a new type with the same keys and values but without any extra type information or attributes.
|
|
50
|
+
* This can be useful for simplifying the displayed type information in development tools.
|
|
51
|
+
*
|
|
52
|
+
* @template T - The object type to prettify.
|
|
53
|
+
*/
|
|
54
|
+
type Prettify<T> = {
|
|
55
|
+
[K in keyof T]: T[K];
|
|
56
|
+
} & {};
|
|
57
|
+
|
|
58
|
+
type RemoveTrailingSlash<T extends string> = T extends `${infer Route}/` ? Route : T;
|
|
59
|
+
|
|
60
|
+
declare function extractArgumentNames(func: {
|
|
61
|
+
toString(): string;
|
|
62
|
+
}): string[];
|
|
63
|
+
|
|
64
|
+
export { type Flatten, type FlattenKeys, type FlattenValues, type MakePropertyOptionalIfChildrenOptional, type Prettify, type RemoveTrailingSlash, extractArgumentNames, isNever, isRecord };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
declare function isNever(value: never): value is never;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if the given object is a record.
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} obj - The object to check.
|
|
7
|
+
* @returns {boolean} - True if the object is a record, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
declare function isRecord(obj: unknown): obj is Record<string, unknown>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A type that represents the values of an object type `T`.
|
|
13
|
+
*
|
|
14
|
+
* This utility type takes an object type `T` and produces a union of its value types.
|
|
15
|
+
*
|
|
16
|
+
* @template T - The object type to extract values from.
|
|
17
|
+
*/
|
|
18
|
+
type FlattenValues<T> = T[keyof T];
|
|
19
|
+
/**
|
|
20
|
+
* A type that represents the keys of an object type `T`.
|
|
21
|
+
*
|
|
22
|
+
* This utility type takes an object type `T` and produces a union of its key types.
|
|
23
|
+
*
|
|
24
|
+
* @template T - The object type to extract keys from.
|
|
25
|
+
*/
|
|
26
|
+
type FlattenKeys<T> = keyof T;
|
|
27
|
+
/**
|
|
28
|
+
* A type that flattens an object type `T`.
|
|
29
|
+
*
|
|
30
|
+
* This utility type takes an object type `T` and recursively flattens it.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The object type to flatten.
|
|
33
|
+
*/
|
|
34
|
+
type Flatten<T> = T extends object ? {
|
|
35
|
+
[K in keyof T]: Flatten<T[K]>;
|
|
36
|
+
} : T;
|
|
37
|
+
|
|
38
|
+
type AllPropertiesOptional<T> = T extends Partial<T> ? (Partial<T> extends T ? true : false) : false;
|
|
39
|
+
type MakePropertyOptionalIfChildrenOptional<T> = {
|
|
40
|
+
[K in keyof T as AllPropertiesOptional<T[K]> extends true ? K : never]?: T[K];
|
|
41
|
+
} & {
|
|
42
|
+
[K in keyof T as AllPropertiesOptional<T[K]> extends true ? never : K]: T[K];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A type that "prettifies" the structure of an object type `T`.
|
|
47
|
+
*
|
|
48
|
+
* This utility type takes an object type `T` and re-maps its keys and values, effectively creating
|
|
49
|
+
* a new type with the same keys and values but without any extra type information or attributes.
|
|
50
|
+
* This can be useful for simplifying the displayed type information in development tools.
|
|
51
|
+
*
|
|
52
|
+
* @template T - The object type to prettify.
|
|
53
|
+
*/
|
|
54
|
+
type Prettify<T> = {
|
|
55
|
+
[K in keyof T]: T[K];
|
|
56
|
+
} & {};
|
|
57
|
+
|
|
58
|
+
type RemoveTrailingSlash<T extends string> = T extends `${infer Route}/` ? Route : T;
|
|
59
|
+
|
|
60
|
+
declare function extractArgumentNames(func: {
|
|
61
|
+
toString(): string;
|
|
62
|
+
}): string[];
|
|
63
|
+
|
|
64
|
+
export { type Flatten, type FlattenKeys, type FlattenValues, type MakePropertyOptionalIfChildrenOptional, type Prettify, type RemoveTrailingSlash, extractArgumentNames, isNever, isRecord };
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
extractArgumentNames: () => extractArgumentNames,
|
|
24
|
+
isNever: () => isNever,
|
|
25
|
+
isRecord: () => isRecord
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
|
|
29
|
+
// src/guards/isNever.ts
|
|
30
|
+
function isNever(value) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/guards/isRecord.ts
|
|
35
|
+
function isRecord(obj) {
|
|
36
|
+
return obj !== null && typeof obj === "object" && !Array.isArray(obj);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/utils/extractArgumentNames.ts
|
|
40
|
+
function extractArgumentNames(func) {
|
|
41
|
+
const fnStr = func.toString();
|
|
42
|
+
const args = fnStr.match(/\(([^)]*)\)/);
|
|
43
|
+
if (!args) return [];
|
|
44
|
+
const argsStr = args[1];
|
|
45
|
+
const result = [];
|
|
46
|
+
let currentArg = "";
|
|
47
|
+
let braceCount = 0;
|
|
48
|
+
for (let i = 0; i < argsStr.length; i++) {
|
|
49
|
+
const char = argsStr[i];
|
|
50
|
+
if (char === "{") braceCount++;
|
|
51
|
+
if (char === "}") braceCount--;
|
|
52
|
+
if (char === "," && braceCount === 0) {
|
|
53
|
+
result.push(currentArg.trim());
|
|
54
|
+
currentArg = "";
|
|
55
|
+
} else {
|
|
56
|
+
if (char === " " || char === "\n" || char === " " || char === "\r")
|
|
57
|
+
continue;
|
|
58
|
+
currentArg += char;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (currentArg) {
|
|
62
|
+
result.push(currentArg.trim());
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
extractArgumentNames,
|
|
69
|
+
isNever,
|
|
70
|
+
isRecord
|
|
71
|
+
});
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/guards/isNever.ts
|
|
2
|
+
function isNever(value) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// src/guards/isRecord.ts
|
|
7
|
+
function isRecord(obj) {
|
|
8
|
+
return obj !== null && typeof obj === "object" && !Array.isArray(obj);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/utils/extractArgumentNames.ts
|
|
12
|
+
function extractArgumentNames(func) {
|
|
13
|
+
const fnStr = func.toString();
|
|
14
|
+
const args = fnStr.match(/\(([^)]*)\)/);
|
|
15
|
+
if (!args) return [];
|
|
16
|
+
const argsStr = args[1];
|
|
17
|
+
const result = [];
|
|
18
|
+
let currentArg = "";
|
|
19
|
+
let braceCount = 0;
|
|
20
|
+
for (let i = 0; i < argsStr.length; i++) {
|
|
21
|
+
const char = argsStr[i];
|
|
22
|
+
if (char === "{") braceCount++;
|
|
23
|
+
if (char === "}") braceCount--;
|
|
24
|
+
if (char === "," && braceCount === 0) {
|
|
25
|
+
result.push(currentArg.trim());
|
|
26
|
+
currentArg = "";
|
|
27
|
+
} else {
|
|
28
|
+
if (char === " " || char === "\n" || char === " " || char === "\r")
|
|
29
|
+
continue;
|
|
30
|
+
currentArg += char;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (currentArg) {
|
|
34
|
+
result.push(currentArg.trim());
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
extractArgumentNames,
|
|
40
|
+
isNever,
|
|
41
|
+
isRecord
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Common package for base types, interfaces, implementations.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**"
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@eslint/js": "^9.
|
|
20
|
+
"@eslint/js": "^9.17.0",
|
|
21
21
|
"@types/jest": "^29.5.14",
|
|
22
22
|
"argparse": "^2.0.1",
|
|
23
23
|
"balanced-match": "^3.0.1",
|
|
24
24
|
"brace-expansion": "^4.0.0",
|
|
25
|
-
"entities": "^
|
|
26
|
-
"eslint": "^9.
|
|
27
|
-
"globals": "^15.
|
|
25
|
+
"entities": "^6.0.0",
|
|
26
|
+
"eslint": "^9.17.0",
|
|
27
|
+
"globals": "^15.14.0",
|
|
28
28
|
"jest": "^29.7.0",
|
|
29
29
|
"linkify-it": "^5.0.0",
|
|
30
30
|
"lunr": "^2.3.9",
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
"mdurl": "^2.0.0",
|
|
33
33
|
"minimatch": "^10.0.1",
|
|
34
34
|
"punycode.js": "^2.3.1",
|
|
35
|
-
"shiki": "^1.
|
|
35
|
+
"shiki": "^1.26.1",
|
|
36
36
|
"ts-jest": "^29.2.5",
|
|
37
37
|
"ts-node": "^10.9.2",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"typescript
|
|
38
|
+
"tsup": "^8.3.5",
|
|
39
|
+
"typedoc": "^0.27.6",
|
|
40
|
+
"typescript": "^5.7.3",
|
|
41
|
+
"typescript-eslint": "^8.19.1",
|
|
41
42
|
"uc.micro": "^2.1.0",
|
|
42
43
|
"vitest": "^2.1.8",
|
|
43
|
-
"yaml": "^2.
|
|
44
|
+
"yaml": "^2.7.0"
|
|
44
45
|
},
|
|
45
46
|
"directories": {
|
|
46
47
|
"test": "tests"
|
|
@@ -48,12 +49,14 @@
|
|
|
48
49
|
"exports": {
|
|
49
50
|
".": {
|
|
50
51
|
"types": "./lib/index.d.ts",
|
|
52
|
+
"import": "./lib/index.mjs",
|
|
53
|
+
"require": "./lib/index.js",
|
|
51
54
|
"default": "./lib/index.js"
|
|
52
55
|
}
|
|
53
56
|
},
|
|
54
57
|
"scripts": {
|
|
55
58
|
"test": "vitest --passWithNoTests",
|
|
56
|
-
"build": "tsc",
|
|
59
|
+
"build": "tsc --noEmit && tsup index.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --dts --clean",
|
|
57
60
|
"clean": "rm -rf lib pnpm.lock.yaml node_modules",
|
|
58
61
|
"docs": "typedoc --out docs *",
|
|
59
62
|
"lint": "eslint . -c eslint.config.mjs",
|
package/lib/guards/isNever.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isNever.d.ts","sourceRoot":"","sources":["../../src/guards/isNever.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,KAAK,CAEpD"}
|
package/lib/guards/isNever.js
DELETED
package/lib/guards/isRecord.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if the given object is a record.
|
|
3
|
-
*
|
|
4
|
-
* @param {unknown} obj - The object to check.
|
|
5
|
-
* @returns {boolean} - True if the object is a record, false otherwise.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isRecord(obj: unknown): obj is Record<string, unknown>;
|
|
8
|
-
//# sourceMappingURL=isRecord.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isRecord.d.ts","sourceRoot":"","sources":["../../src/guards/isRecord.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAErE"}
|
package/lib/guards/isRecord.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if the given object is a record.
|
|
3
|
-
*
|
|
4
|
-
* @param {unknown} obj - The object to check.
|
|
5
|
-
* @returns {boolean} - True if the object is a record, false otherwise.
|
|
6
|
-
*/
|
|
7
|
-
export function isRecord(obj) {
|
|
8
|
-
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
|
9
|
-
}
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sDAAsD,CAAC;AACrE,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A type that represents the values of an object type `T`.
|
|
3
|
-
*
|
|
4
|
-
* This utility type takes an object type `T` and produces a union of its value types.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The object type to extract values from.
|
|
7
|
-
*/
|
|
8
|
-
export type FlattenValues<T> = T[keyof T];
|
|
9
|
-
/**
|
|
10
|
-
* A type that represents the keys of an object type `T`.
|
|
11
|
-
*
|
|
12
|
-
* This utility type takes an object type `T` and produces a union of its key types.
|
|
13
|
-
*
|
|
14
|
-
* @template T - The object type to extract keys from.
|
|
15
|
-
*/
|
|
16
|
-
export type FlattenKeys<T> = keyof T;
|
|
17
|
-
/**
|
|
18
|
-
* A type that flattens an object type `T`.
|
|
19
|
-
*
|
|
20
|
-
* This utility type takes an object type `T` and recursively flattens it.
|
|
21
|
-
*
|
|
22
|
-
* @template T - The object type to flatten.
|
|
23
|
-
*/
|
|
24
|
-
export type Flatten<T> = T extends object ? {
|
|
25
|
-
[K in keyof T]: Flatten<T[K]>;
|
|
26
|
-
} : T;
|
|
27
|
-
//# sourceMappingURL=flatten.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.types.d.ts","sourceRoot":"","sources":["../../src/types/flatten.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACrC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACjC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type AllPropertiesOptional<T> = T extends Partial<T> ? (Partial<T> extends T ? true : false) : false;
|
|
2
|
-
export type MakePropertyOptionalIfChildrenOptional<T> = {
|
|
3
|
-
[K in keyof T as AllPropertiesOptional<T[K]> extends true ? K : never]?: T[K];
|
|
4
|
-
} & {
|
|
5
|
-
[K in keyof T as AllPropertiesOptional<T[K]> extends true ? never : K]: T[K];
|
|
6
|
-
};
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=makePropertyOptionalIfChildrenOptional.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"makePropertyOptionalIfChildrenOptional.types.d.ts","sourceRoot":"","sources":["../../src/types/makePropertyOptionalIfChildrenOptional.types.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,CAAC,CAAC,IAC1B,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEvE,MAAM,MAAM,sCAAsC,CAAC,CAAC,IAAI;KACrD,CAAC,IAAI,MAAM,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAC9E,GAAG;KACD,CAAC,IAAI,MAAM,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A type that "prettifies" the structure of an object type `T`.
|
|
3
|
-
*
|
|
4
|
-
* This utility type takes an object type `T` and re-maps its keys and values, effectively creating
|
|
5
|
-
* a new type with the same keys and values but without any extra type information or attributes.
|
|
6
|
-
* This can be useful for simplifying the displayed type information in development tools.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The object type to prettify.
|
|
9
|
-
*/
|
|
10
|
-
export type Prettify<T> = {
|
|
11
|
-
[K in keyof T]: T[K];
|
|
12
|
-
} & {};
|
|
13
|
-
//# sourceMappingURL=prettify.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prettify.types.d.ts","sourceRoot":"","sources":["../../src/types/prettify.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GAAG,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"removeTrailingSlash.types.d.ts","sourceRoot":"","sources":["../../src/types/removeTrailingSlash.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,KAAK,GAAG,GAC3E,KAAK,GACL,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractArgumentNames.d.ts","sourceRoot":"","sources":["../../src/utils/extractArgumentNames.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAAE,QAAQ,IAAI,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CA+B3E"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export function extractArgumentNames(func) {
|
|
2
|
-
const fnStr = func.toString();
|
|
3
|
-
const args = fnStr.match(/\(([^)]*)\)/);
|
|
4
|
-
if (!args)
|
|
5
|
-
return [];
|
|
6
|
-
const argsStr = args[1];
|
|
7
|
-
const result = [];
|
|
8
|
-
let currentArg = '';
|
|
9
|
-
let braceCount = 0;
|
|
10
|
-
for (let i = 0; i < argsStr.length; i++) {
|
|
11
|
-
const char = argsStr[i];
|
|
12
|
-
if (char === '{')
|
|
13
|
-
braceCount++;
|
|
14
|
-
if (char === '}')
|
|
15
|
-
braceCount--;
|
|
16
|
-
if (char === ',' && braceCount === 0) {
|
|
17
|
-
result.push(currentArg.trim());
|
|
18
|
-
currentArg = '';
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
if (char === ' ' || char === '\n' || char === '\t' || char === '\r')
|
|
22
|
-
continue;
|
|
23
|
-
currentArg += char;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (currentArg) {
|
|
27
|
-
result.push(currentArg.trim());
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
30
|
-
}
|