@duplojs/lang 0.0.1-beta.9 → 0.1.0-beta.1
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/concat.d.ts +2 -2
- package/dist/array/flat.d.ts +1 -1
- package/dist/array/flatMap.d.ts +2 -2
- package/dist/array/from.d.ts +1 -1
- package/dist/array/length.d.ts +3 -2
- package/dist/array/push.d.ts +4 -2
- package/dist/chrono/createDate.cjs +1 -1
- package/dist/chrono/createDate.mjs +1 -1
- package/dist/chrono/operators/addTime.d.ts +2 -4
- package/dist/common/constraint/cast/index.d.ts +4 -4
- package/dist/common/constraint/cast/string.d.ts +4 -0
- package/dist/common/constraint/infer/index.d.ts +2 -1
- package/dist/common/constraint/infer/string.d.ts +1 -1
- package/dist/common/constraint/types/index.d.ts +1 -0
- package/dist/common/constraint/types/maybe.d.ts +2 -0
- package/dist/common/formData.d.ts +2 -1
- package/dist/common/memo.cjs +3 -2
- package/dist/common/memo.mjs +3 -2
- package/dist/common/memoPromise.cjs +3 -2
- package/dist/common/memoPromise.mjs +3 -2
- package/dist/common/timeout.cjs +2 -2
- package/dist/common/timeout.d.ts +1 -1
- package/dist/common/timeout.mjs +2 -2
- package/dist/common/types/applyPromiseIf.d.ts +1 -0
- package/dist/common/types/index.d.ts +1 -0
- package/dist/common/types/json.d.ts +12 -1
- package/dist/dataStructure/common/codec/defaults/string.cjs +1 -1
- package/dist/dataStructure/common/codec/defaults/string.d.ts +1 -1
- package/dist/dataStructure/common/codec/defaults/string.mjs +1 -1
- package/dist/dataStructure/common/{error.cjs → error/base.cjs} +18 -3
- package/dist/dataStructure/common/{error.d.ts → error/base.d.ts} +14 -7
- package/dist/dataStructure/common/{error.mjs → error/base.mjs} +17 -4
- package/dist/dataStructure/common/error/defaultInterpreter.cjs +87 -0
- package/dist/dataStructure/common/error/defaultInterpreter.d.ts +60 -0
- package/dist/dataStructure/common/error/defaultInterpreter.mjs +86 -0
- package/dist/dataStructure/common/error/index.d.ts +3 -0
- package/dist/dataStructure/common/{errorInterpreter.cjs → error/interpreter.cjs} +11 -12
- package/dist/dataStructure/common/error/interpreter.d.ts +32 -0
- package/dist/dataStructure/common/{errorInterpreter.mjs → error/interpreter.mjs} +9 -10
- package/dist/dataStructure/common/index.d.ts +0 -1
- package/dist/dataStructure/constraint/types/constraints.d.ts +1 -0
- package/dist/dataStructure/fundamentalType/types/fundamentalTypes.d.ts +1 -0
- package/dist/dataStructure/helpers/extend.cjs +1 -1
- package/dist/dataStructure/helpers/extend.d.ts +1 -1
- package/dist/dataStructure/helpers/extend.mjs +1 -1
- package/dist/dataStructure/helpers/index.d.ts +1 -0
- package/dist/dataStructure/helpers/partial.cjs +1 -1
- package/dist/dataStructure/helpers/partial.mjs +1 -1
- package/dist/dataStructure/helpers/required.cjs +1 -1
- package/dist/dataStructure/helpers/required.mjs +1 -1
- package/dist/dataStructure/helpers/typeStructureIdentifier.cjs +14 -0
- package/dist/dataStructure/helpers/typeStructureIdentifier.d.ts +6 -0
- package/dist/dataStructure/helpers/typeStructureIdentifier.mjs +14 -0
- package/dist/dataStructure/index.cjs +45 -33
- package/dist/dataStructure/index.mjs +10 -3
- package/dist/dataStructure/structure/base.cjs +31 -19
- package/dist/dataStructure/structure/base.d.ts +16 -16
- package/dist/dataStructure/structure/base.mjs +25 -13
- package/dist/dataStructure/structure/defaults/array.cjs +10 -0
- package/dist/dataStructure/structure/defaults/array.mjs +10 -0
- package/dist/dataStructure/structure/defaults/lazy.cjs +1 -0
- package/dist/dataStructure/structure/defaults/lazy.mjs +1 -0
- package/dist/dataStructure/structure/defaults/nonEncodableString.cjs +1 -0
- package/dist/dataStructure/structure/defaults/nonEncodableString.mjs +1 -0
- package/dist/dataStructure/structure/defaults/object.cjs +18 -7
- package/dist/dataStructure/structure/defaults/object.d.ts +2 -1
- package/dist/dataStructure/structure/defaults/object.mjs +18 -7
- package/dist/dataStructure/structure/defaults/record.cjs +20 -7
- package/dist/dataStructure/structure/defaults/record.mjs +20 -7
- package/dist/dataStructure/structure/defaults/type.cjs +1 -0
- package/dist/dataStructure/structure/defaults/type.mjs +1 -0
- package/dist/dataStructure/structure/defaults/union.cjs +26 -6
- package/dist/dataStructure/structure/defaults/union.mjs +21 -1
- package/dist/dataStructure/structure/types/value.d.ts +2 -0
- package/dist/dataStructure/type/types/types.d.ts +1 -0
- package/dist/either/index.cjs +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/either/left/create.d.ts +2 -1
- package/dist/either/left/none.cjs +2 -2
- package/dist/either/left/none.d.ts +2 -2
- package/dist/either/left/none.mjs +2 -2
- package/dist/either/right/create.d.ts +2 -1
- package/dist/either/types/index.d.ts +1 -0
- package/dist/either/types/mayBe.d.ts +1 -1
- package/dist/invocation/evidence.d.ts +1 -1
- package/dist/invocation/flow/base.cjs +4 -4
- package/dist/invocation/flow/base.d.ts +1 -1
- package/dist/invocation/flow/base.mjs +4 -4
- package/dist/invocation/flow/controller/defaults/debounce.cjs +1 -1
- package/dist/invocation/flow/controller/defaults/debounce.mjs +1 -1
- package/dist/invocation/flow/controller/defaults/throttling.cjs +1 -1
- package/dist/invocation/flow/controller/defaults/throttling.mjs +1 -1
- package/dist/invocation/index.cjs +10 -0
- package/dist/invocation/index.d.ts +2 -0
- package/dist/invocation/index.mjs +7 -1
- package/dist/invocation/reader.cjs +5 -1
- package/dist/invocation/reader.d.ts +5 -3
- package/dist/invocation/reader.mjs +5 -1
- package/dist/invocation/resolver.cjs +31 -0
- package/dist/invocation/resolver.d.ts +14 -0
- package/dist/invocation/resolver.mjs +31 -0
- package/dist/invocation/signature.cjs +8 -0
- package/dist/invocation/signature.d.ts +7 -0
- package/dist/invocation/signature.mjs +8 -0
- package/dist/modeling/entity/base.cjs +19 -25
- package/dist/modeling/entity/base.d.ts +15 -14
- package/dist/modeling/entity/base.mjs +14 -19
- package/dist/modeling/entity/helper.d.ts +6 -8
- package/dist/modeling/entity/namespace.cjs +0 -2
- package/dist/modeling/entity/namespace.d.ts +0 -2
- package/dist/modeling/entity/namespace.mjs +0 -2
- package/dist/modeling/fact/base.cjs +36 -0
- package/dist/modeling/fact/base.d.ts +29 -0
- package/dist/modeling/fact/base.mjs +35 -0
- package/dist/modeling/fact/index.d.ts +1 -0
- package/dist/modeling/flag/base.cjs +1 -1
- package/dist/modeling/flag/base.d.ts +8 -8
- package/dist/modeling/flag/base.mjs +1 -1
- package/dist/modeling/index.cjs +17 -18
- package/dist/modeling/index.d.ts +1 -0
- package/dist/modeling/index.mjs +8 -8
- package/dist/modeling/newType/base.cjs +11 -28
- package/dist/modeling/newType/base.d.ts +8 -15
- package/dist/modeling/newType/base.mjs +5 -20
- package/dist/modeling/taggedObject/base.cjs +19 -25
- package/dist/modeling/taggedObject/base.d.ts +12 -14
- package/dist/modeling/taggedObject/base.mjs +14 -19
- package/dist/object/assign.d.ts +3 -3
- package/dist/object/deepOverride.cjs +33 -0
- package/dist/object/deepOverride.d.ts +20 -0
- package/dist/object/deepOverride.mjs +33 -0
- package/dist/object/entries.d.ts +3 -3
- package/dist/object/index.cjs +4 -1
- package/dist/object/index.d.ts +1 -0
- package/dist/object/index.mjs +4 -2
- package/dist/object/isSimple.cjs +1 -1
- package/dist/object/isSimple.mjs +1 -1
- package/dist/object/keys.d.ts +1 -1
- package/dist/object/override.cjs +1 -1
- package/dist/object/override.d.ts +5 -2
- package/dist/object/override.mjs +1 -1
- package/dist/object/types/assign.d.ts +2 -0
- package/dist/object/types/forbiddenKey.d.ts +1 -1
- package/dist/object/types/hasKeySignature.d.ts +1 -0
- package/dist/object/types/index.d.ts +4 -1
- package/dist/object/types/keyofWithoutSignature.d.ts +3 -0
- package/dist/object/types/override.d.ts +4 -0
- package/dist/object/values.d.ts +1 -1
- package/dist/path/create.cjs +11 -0
- package/dist/path/create.d.ts +3 -0
- package/dist/path/create.mjs +11 -0
- package/dist/path/createAbsolute.cjs +12 -0
- package/dist/path/createAbsolute.d.ts +3 -0
- package/dist/path/createAbsolute.mjs +12 -0
- package/dist/path/createAbsoluteOrThrow.cjs +22 -0
- package/dist/path/createAbsoluteOrThrow.d.ts +9 -0
- package/dist/path/createAbsoluteOrThrow.mjs +21 -0
- package/dist/path/createOrThrow.cjs +22 -0
- package/dist/path/createOrThrow.d.ts +9 -0
- package/dist/path/createOrThrow.mjs +21 -0
- package/dist/path/createSegment.cjs +12 -0
- package/dist/path/createSegment.d.ts +3 -0
- package/dist/path/createSegment.mjs +12 -0
- package/dist/path/createSegmentOrThrow.cjs +22 -0
- package/dist/path/createSegmentOrThrow.d.ts +9 -0
- package/dist/path/createSegmentOrThrow.mjs +21 -0
- package/dist/path/declareAbsolutePath.cjs +6 -0
- package/dist/path/declareAbsolutePath.d.ts +3 -0
- package/dist/path/declareAbsolutePath.mjs +6 -0
- package/dist/path/declarePath.cjs +6 -0
- package/dist/path/declarePath.d.ts +3 -0
- package/dist/path/declarePath.mjs +6 -0
- package/dist/path/declareSegment.cjs +6 -0
- package/dist/path/declareSegment.d.ts +3 -0
- package/dist/path/declareSegment.mjs +6 -0
- package/dist/path/index.cjs +39 -3
- package/dist/path/index.d.ts +10 -0
- package/dist/path/index.mjs +27 -4
- package/dist/path/kind.cjs +4 -0
- package/dist/path/kind.d.ts +2 -0
- package/dist/path/kind.mjs +5 -0
- package/dist/pattern/index.cjs +6 -0
- package/dist/pattern/index.d.ts +2 -0
- package/dist/pattern/index.mjs +5 -1
- package/dist/pattern/match/builder.cjs +1 -1
- package/dist/pattern/match/builder.mjs +1 -1
- package/dist/pattern/matchWithEntityOtherwise.d.ts +2 -2
- package/dist/pattern/matchWithFact.cjs +12 -0
- package/dist/pattern/matchWithFact.d.ts +12 -0
- package/dist/pattern/matchWithFact.mjs +12 -0
- package/dist/pattern/matchWithFactOtherwise.cjs +13 -0
- package/dist/pattern/matchWithFactOtherwise.d.ts +14 -0
- package/dist/pattern/matchWithFactOtherwise.mjs +13 -0
- package/dist/pattern/matchWithNumberOtherwise.d.ts +2 -2
- package/dist/pattern/matchWithStringOtherwise.d.ts +2 -2
- package/dist/pattern/matchWithTaggedObjectOtherwise.d.ts +2 -2
- package/dist/pattern/types/complexUnMatchedValue/getIncompleteUnion.d.ts +8 -8
- package/dist/string/capitalize.d.ts +1 -1
- package/dist/string/concat.d.ts +2 -2
- package/dist/string/prepend.d.ts +2 -2
- package/dist/string/split.cjs +1 -0
- package/dist/string/split.d.ts +3 -3
- package/dist/string/split.mjs +1 -0
- package/dist/string/toLowerCase.d.ts +1 -1
- package/dist/string/toUpperCase.d.ts +1 -1
- package/dist/string/types/IsAllowedString.d.ts +4 -2
- package/dist/string/uncapitalize.d.ts +1 -1
- package/dist/tuple/types/map.d.ts +1 -1
- package/package.json +16 -30
- package/dist/dataStructure/common/errorInterpreter.d.ts +0 -36
- package/dist/object/types/assignObjects.d.ts +0 -2
- /package/{README.md → README} +0 -0
package/dist/path/index.cjs
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_computeRelative = require("./computeRelative.cjs");
|
|
3
|
+
const require_normalize = require("./normalize.cjs");
|
|
4
|
+
const require_create = require("./create.cjs");
|
|
5
|
+
const require_is = require("./is.cjs");
|
|
6
|
+
const require_isAbsolute = require("./isAbsolute.cjs");
|
|
7
|
+
const require_createAbsolute = require("./createAbsolute.cjs");
|
|
8
|
+
const require_kind = require("./kind.cjs");
|
|
9
|
+
const require_createAbsoluteOrThrow = require("./createAbsoluteOrThrow.cjs");
|
|
10
|
+
const require_createOrThrow = require("./createOrThrow.cjs");
|
|
3
11
|
const require_isSegment = require("./isSegment.cjs");
|
|
12
|
+
const require_createSegment = require("./createSegment.cjs");
|
|
13
|
+
const require_createSegmentOrThrow = require("./createSegmentOrThrow.cjs");
|
|
14
|
+
const require_declareAbsolutePath = require("./declareAbsolutePath.cjs");
|
|
15
|
+
const require_declarePath = require("./declarePath.cjs");
|
|
16
|
+
const require_declareSegment = require("./declareSegment.cjs");
|
|
4
17
|
const require_getBaseName = require("./getBaseName.cjs");
|
|
5
18
|
const require_getExtensionName = require("./getExtensionName.cjs");
|
|
6
19
|
const require_getParentFolderPath = require("./getParentFolderPath.cjs");
|
|
7
|
-
const require_is = require("./is.cjs");
|
|
8
|
-
const require_isAbsolute = require("./isAbsolute.cjs");
|
|
9
|
-
const require_normalize = require("./normalize.cjs");
|
|
10
20
|
const require_resolveRelative = require("./resolveRelative.cjs");
|
|
11
21
|
const require_resolveFrom = require("./resolveFrom.cjs");
|
|
12
22
|
//#region scripts/path/index.ts
|
|
13
23
|
var path_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
24
|
+
CreateAbsolutePathError: () => require_createAbsoluteOrThrow.CreateAbsolutePathError,
|
|
25
|
+
CreatePathError: () => require_createOrThrow.CreatePathError,
|
|
26
|
+
CreateSegmentPathError: () => require_createSegmentOrThrow.CreateSegmentPathError,
|
|
14
27
|
computeRelative: () => require_computeRelative.computeRelative,
|
|
28
|
+
create: () => require_create.create,
|
|
29
|
+
createAbsolute: () => require_createAbsolute.createAbsolute,
|
|
30
|
+
createAbsoluteOrThrow: () => require_createAbsoluteOrThrow.createAbsoluteOrThrow,
|
|
31
|
+
createKind: () => require_kind.createKind,
|
|
32
|
+
createOrThrow: () => require_createOrThrow.createOrThrow,
|
|
33
|
+
createSegment: () => require_createSegment.createSegment,
|
|
34
|
+
createSegmentOrThrow: () => require_createSegmentOrThrow.createSegmentOrThrow,
|
|
35
|
+
declareAbsolutePath: () => require_declareAbsolutePath.declareAbsolutePath,
|
|
36
|
+
declarePath: () => require_declarePath.declarePath,
|
|
37
|
+
declareSegment: () => require_declareSegment.declareSegment,
|
|
15
38
|
getBaseName: () => require_getBaseName.getBaseName,
|
|
16
39
|
getExtensionName: () => require_getExtensionName.getExtensionName,
|
|
17
40
|
getParentFolderPath: () => require_getParentFolderPath.getParentFolderPath,
|
|
@@ -23,7 +46,20 @@ var path_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
|
23
46
|
resolveRelative: () => require_resolveRelative.resolveRelative
|
|
24
47
|
});
|
|
25
48
|
//#endregion
|
|
49
|
+
exports.CreateAbsolutePathError = require_createAbsoluteOrThrow.CreateAbsolutePathError;
|
|
50
|
+
exports.CreatePathError = require_createOrThrow.CreatePathError;
|
|
51
|
+
exports.CreateSegmentPathError = require_createSegmentOrThrow.CreateSegmentPathError;
|
|
26
52
|
exports.computeRelative = require_computeRelative.computeRelative;
|
|
53
|
+
exports.create = require_create.create;
|
|
54
|
+
exports.createAbsolute = require_createAbsolute.createAbsolute;
|
|
55
|
+
exports.createAbsoluteOrThrow = require_createAbsoluteOrThrow.createAbsoluteOrThrow;
|
|
56
|
+
exports.createKind = require_kind.createKind;
|
|
57
|
+
exports.createOrThrow = require_createOrThrow.createOrThrow;
|
|
58
|
+
exports.createSegment = require_createSegment.createSegment;
|
|
59
|
+
exports.createSegmentOrThrow = require_createSegmentOrThrow.createSegmentOrThrow;
|
|
60
|
+
exports.declareAbsolutePath = require_declareAbsolutePath.declareAbsolutePath;
|
|
61
|
+
exports.declarePath = require_declarePath.declarePath;
|
|
62
|
+
exports.declareSegment = require_declareSegment.declareSegment;
|
|
27
63
|
exports.getBaseName = require_getBaseName.getBaseName;
|
|
28
64
|
exports.getExtensionName = require_getExtensionName.getExtensionName;
|
|
29
65
|
exports.getParentFolderPath = require_getParentFolderPath.getParentFolderPath;
|
package/dist/path/index.d.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
export * from './computeRelative';
|
|
2
2
|
export type * from './constraints';
|
|
3
|
+
export * from './create';
|
|
4
|
+
export * from './createAbsolute';
|
|
5
|
+
export * from './createAbsoluteOrThrow';
|
|
6
|
+
export * from './createOrThrow';
|
|
7
|
+
export * from './createSegment';
|
|
8
|
+
export * from './createSegmentOrThrow';
|
|
9
|
+
export * from './declareAbsolutePath';
|
|
10
|
+
export * from './declarePath';
|
|
11
|
+
export * from './declareSegment';
|
|
3
12
|
export * from './getBaseName';
|
|
4
13
|
export * from './getExtensionName';
|
|
5
14
|
export * from './getParentFolderPath';
|
|
6
15
|
export * from './is';
|
|
7
16
|
export * from './isAbsolute';
|
|
8
17
|
export * from './isSegment';
|
|
18
|
+
export * from './kind';
|
|
9
19
|
export * from './normalize';
|
|
10
20
|
export * from './resolveFrom';
|
|
11
21
|
export * from './resolveRelative';
|
package/dist/path/index.mjs
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { computeRelative } from "./computeRelative.mjs";
|
|
3
|
+
import { normalize } from "./normalize.mjs";
|
|
4
|
+
import { create } from "./create.mjs";
|
|
5
|
+
import { is } from "./is.mjs";
|
|
6
|
+
import { isAbsolute } from "./isAbsolute.mjs";
|
|
7
|
+
import { createAbsolute } from "./createAbsolute.mjs";
|
|
8
|
+
import { createKind } from "./kind.mjs";
|
|
9
|
+
import { CreateAbsolutePathError, createAbsoluteOrThrow } from "./createAbsoluteOrThrow.mjs";
|
|
10
|
+
import { CreatePathError, createOrThrow } from "./createOrThrow.mjs";
|
|
3
11
|
import { isSegment } from "./isSegment.mjs";
|
|
12
|
+
import { createSegment } from "./createSegment.mjs";
|
|
13
|
+
import { CreateSegmentPathError, createSegmentOrThrow } from "./createSegmentOrThrow.mjs";
|
|
14
|
+
import { declareAbsolutePath } from "./declareAbsolutePath.mjs";
|
|
15
|
+
import { declarePath } from "./declarePath.mjs";
|
|
16
|
+
import { declareSegment } from "./declareSegment.mjs";
|
|
4
17
|
import { getBaseName } from "./getBaseName.mjs";
|
|
5
18
|
import { getExtensionName } from "./getExtensionName.mjs";
|
|
6
19
|
import { getParentFolderPath } from "./getParentFolderPath.mjs";
|
|
7
|
-
import { is } from "./is.mjs";
|
|
8
|
-
import { isAbsolute } from "./isAbsolute.mjs";
|
|
9
|
-
import { normalize } from "./normalize.mjs";
|
|
10
20
|
import { resolveRelative } from "./resolveRelative.mjs";
|
|
11
21
|
import { resolveFrom } from "./resolveFrom.mjs";
|
|
12
22
|
//#region scripts/path/index.ts
|
|
13
23
|
var path_exports = /* @__PURE__ */ __exportAll({
|
|
24
|
+
CreateAbsolutePathError: () => CreateAbsolutePathError,
|
|
25
|
+
CreatePathError: () => CreatePathError,
|
|
26
|
+
CreateSegmentPathError: () => CreateSegmentPathError,
|
|
14
27
|
computeRelative: () => computeRelative,
|
|
28
|
+
create: () => create,
|
|
29
|
+
createAbsolute: () => createAbsolute,
|
|
30
|
+
createAbsoluteOrThrow: () => createAbsoluteOrThrow,
|
|
31
|
+
createKind: () => createKind,
|
|
32
|
+
createOrThrow: () => createOrThrow,
|
|
33
|
+
createSegment: () => createSegment,
|
|
34
|
+
createSegmentOrThrow: () => createSegmentOrThrow,
|
|
35
|
+
declareAbsolutePath: () => declareAbsolutePath,
|
|
36
|
+
declarePath: () => declarePath,
|
|
37
|
+
declareSegment: () => declareSegment,
|
|
15
38
|
getBaseName: () => getBaseName,
|
|
16
39
|
getExtensionName: () => getExtensionName,
|
|
17
40
|
getParentFolderPath: () => getParentFolderPath,
|
|
@@ -23,4 +46,4 @@ var path_exports = /* @__PURE__ */ __exportAll({
|
|
|
23
46
|
resolveRelative: () => resolveRelative
|
|
24
47
|
});
|
|
25
48
|
//#endregion
|
|
26
|
-
export { computeRelative, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, isSegment, normalize, path_exports, resolveFrom, resolveRelative };
|
|
49
|
+
export { CreateAbsolutePathError, CreatePathError, CreateSegmentPathError, computeRelative, create, createAbsolute, createAbsoluteOrThrow, createKind, createOrThrow, createSegment, createSegmentOrThrow, declareAbsolutePath, declarePath, declareSegment, getBaseName, getExtensionName, getParentFolderPath, is, isAbsolute, isSegment, normalize, path_exports, resolveFrom, resolveRelative };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import * as DKind from '../kind';
|
|
2
|
+
export declare const createKind: <GenericName extends string, GenericKindValue extends unknown = unknown>(name: GenericName & import('../string').ForbiddenContain<GenericName, DKind.ForbiddenKindNameCharacter>) => DKind.Handler<DKind.Definition<`@DuplojsLangPath/${GenericName}`, GenericKindValue>>;
|
package/dist/pattern/index.cjs
CHANGED
|
@@ -16,6 +16,8 @@ const require_matchWithTaggedObject = require("./matchWithTaggedObject.cjs");
|
|
|
16
16
|
const require_matchWithTaggedObjectOtherwise = require("./matchWithTaggedObjectOtherwise.cjs");
|
|
17
17
|
const require_matchWithEntity = require("./matchWithEntity.cjs");
|
|
18
18
|
const require_matchWithEntityOtherwise = require("./matchWithEntityOtherwise.cjs");
|
|
19
|
+
const require_matchWithFact = require("./matchWithFact.cjs");
|
|
20
|
+
const require_matchWithFactOtherwise = require("./matchWithFactOtherwise.cjs");
|
|
19
21
|
//#region scripts/pattern/index.ts
|
|
20
22
|
var pattern_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
21
23
|
InvalidExhaustivePatternError: () => require_builder.InvalidExhaustivePatternError,
|
|
@@ -26,6 +28,8 @@ var pattern_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
|
26
28
|
matchBuilder: () => require_builder.matchBuilder,
|
|
27
29
|
matchWithEntity: () => require_matchWithEntity.matchWithEntity,
|
|
28
30
|
matchWithEntityOtherwise: () => require_matchWithEntityOtherwise.matchWithEntityOtherwise,
|
|
31
|
+
matchWithFact: () => require_matchWithFact.matchWithFact,
|
|
32
|
+
matchWithFactOtherwise: () => require_matchWithFactOtherwise.matchWithFactOtherwise,
|
|
29
33
|
matchWithNumber: () => require_matchWithNumber.matchWithNumber,
|
|
30
34
|
matchWithNumberOtherwise: () => require_matchWithNumberOtherwise.matchWithNumberOtherwise,
|
|
31
35
|
matchWithString: () => require_matchWithString.matchWithString,
|
|
@@ -47,6 +51,8 @@ exports.match = require_index.match;
|
|
|
47
51
|
exports.matchBuilder = require_builder.matchBuilder;
|
|
48
52
|
exports.matchWithEntity = require_matchWithEntity.matchWithEntity;
|
|
49
53
|
exports.matchWithEntityOtherwise = require_matchWithEntityOtherwise.matchWithEntityOtherwise;
|
|
54
|
+
exports.matchWithFact = require_matchWithFact.matchWithFact;
|
|
55
|
+
exports.matchWithFactOtherwise = require_matchWithFactOtherwise.matchWithFactOtherwise;
|
|
50
56
|
exports.matchWithNumber = require_matchWithNumber.matchWithNumber;
|
|
51
57
|
exports.matchWithNumberOtherwise = require_matchWithNumberOtherwise.matchWithNumberOtherwise;
|
|
52
58
|
exports.matchWithString = require_matchWithString.matchWithString;
|
package/dist/pattern/index.d.ts
CHANGED
package/dist/pattern/index.mjs
CHANGED
|
@@ -16,6 +16,8 @@ import { matchWithTaggedObject } from "./matchWithTaggedObject.mjs";
|
|
|
16
16
|
import { matchWithTaggedObjectOtherwise } from "./matchWithTaggedObjectOtherwise.mjs";
|
|
17
17
|
import { matchWithEntity } from "./matchWithEntity.mjs";
|
|
18
18
|
import { matchWithEntityOtherwise } from "./matchWithEntityOtherwise.mjs";
|
|
19
|
+
import { matchWithFact } from "./matchWithFact.mjs";
|
|
20
|
+
import { matchWithFactOtherwise } from "./matchWithFactOtherwise.mjs";
|
|
19
21
|
//#region scripts/pattern/index.ts
|
|
20
22
|
var pattern_exports = /* @__PURE__ */ __exportAll({
|
|
21
23
|
InvalidExhaustivePatternError: () => InvalidExhaustivePatternError,
|
|
@@ -26,6 +28,8 @@ var pattern_exports = /* @__PURE__ */ __exportAll({
|
|
|
26
28
|
matchBuilder: () => matchBuilder,
|
|
27
29
|
matchWithEntity: () => matchWithEntity,
|
|
28
30
|
matchWithEntityOtherwise: () => matchWithEntityOtherwise,
|
|
31
|
+
matchWithFact: () => matchWithFact,
|
|
32
|
+
matchWithFactOtherwise: () => matchWithFactOtherwise,
|
|
29
33
|
matchWithNumber: () => matchWithNumber,
|
|
30
34
|
matchWithNumberOtherwise: () => matchWithNumberOtherwise,
|
|
31
35
|
matchWithString: () => matchWithString,
|
|
@@ -39,4 +43,4 @@ var pattern_exports = /* @__PURE__ */ __exportAll({
|
|
|
39
43
|
whenNot: () => whenNot
|
|
40
44
|
});
|
|
41
45
|
//#endregion
|
|
42
|
-
export { InvalidExhaustivePatternError, exhaustive, isMatch, isResult, match, matchBuilder, matchWithEntity, matchWithEntityOtherwise, matchWithNumber, matchWithNumberOtherwise, matchWithString, matchWithStringOtherwise, matchWithTaggedObject, matchWithTaggedObjectOtherwise, otherwise, pattern_exports, result, union, when, whenNot };
|
|
46
|
+
export { InvalidExhaustivePatternError, exhaustive, isMatch, isResult, match, matchBuilder, matchWithEntity, matchWithEntityOtherwise, matchWithFact, matchWithFactOtherwise, matchWithNumber, matchWithNumberOtherwise, matchWithString, matchWithStringOtherwise, matchWithTaggedObject, matchWithTaggedObjectOtherwise, otherwise, pattern_exports, result, union, when, whenNot };
|
|
@@ -12,7 +12,7 @@ var InvalidExhaustivePatternError = class extends require_parentClass.parentClas
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
const matchBuilder = require_justExec.justExec(() => {
|
|
15
|
-
const builder = require_builder.createBuilder("@duplojs/
|
|
15
|
+
const builder = require_builder.createBuilder("@duplojs/lang/pattern/match");
|
|
16
16
|
builder.set("with", ({ args: [pattern, theFunction], accumulator, next }) => next({
|
|
17
17
|
...accumulator,
|
|
18
18
|
matchers: [...accumulator.matchers, {
|
|
@@ -12,7 +12,7 @@ var InvalidExhaustivePatternError = class extends parentClass(createKind("invali
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
const matchBuilder = justExec(() => {
|
|
15
|
-
const builder = createBuilder("@duplojs/
|
|
15
|
+
const builder = createBuilder("@duplojs/lang/pattern/match");
|
|
16
16
|
builder.set("with", ({ args: [pattern, theFunction], accumulator, next }) => next({
|
|
17
17
|
...accumulator,
|
|
18
18
|
matchers: [...accumulator.matchers, {
|
|
@@ -9,6 +9,6 @@ type ForbiddenMoreKey<GenericEntity extends DModeling.Entity, GenericMatcher ext
|
|
|
9
9
|
type HandledKeys<GenericMatcher extends object> = Extract<DObject.GetPropsWithValueExtends<GenericMatcher, DCommon.AnyFunction>, string>;
|
|
10
10
|
type UnhandledEntity<GenericEntity extends DModeling.Entity, GenericMatcher extends object> = Exclude<GenericEntity, DModeling.ExtractByEntityName<GenericEntity, HandledKeys<GenericMatcher>>>;
|
|
11
11
|
type RequireSimpleName<GenericEntity extends DModeling.Entity> = DString.RequireSimpleLiteral<DModeling.GetEntityName<GenericEntity>>;
|
|
12
|
-
export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericEntity>, GenericMatcher>), otherwise: (value: UnhandledEntity<GenericEntity, GenericMatcher
|
|
13
|
-
export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(input: GenericEntity & RequireSimpleName<GenericEntity>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<GenericEntity, GenericMatcher>), otherwise: (value: UnhandledEntity<GenericEntity, GenericMatcher
|
|
12
|
+
export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericEntity>, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledEntity<GenericEntity, GenericMatcher>>) => GenericOutput): (input: GenericEntity & RequireSimpleName<GenericEntity>) => (ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
13
|
+
export declare function matchWithEntityOtherwise<GenericEntity extends DModeling.Entity, GenericMatcher extends ComputeMatcher<GenericEntity>, GenericOutput>(input: GenericEntity & RequireSimpleName<GenericEntity>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericEntity>, GenericMatcher> & ForbiddenMoreKey<GenericEntity, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledEntity<GenericEntity, GenericMatcher>>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
14
14
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_base = require("../modeling/fact/base.cjs");
|
|
2
|
+
//#region scripts/pattern/matchWithFact.ts
|
|
3
|
+
function matchWithFact(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [matcher] = args;
|
|
6
|
+
return (input) => matcher[require_base.factKind.getValue(input).name](input);
|
|
7
|
+
}
|
|
8
|
+
const [input, matcher] = args;
|
|
9
|
+
return matcher[require_base.factKind.getValue(input).name](input, require_base.factKind.getValue(input).payload);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.matchWithFact = matchWithFact;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as DCommon from '../common';
|
|
2
|
+
import * as DModeling from '../modeling';
|
|
3
|
+
import type * as DObject from '../object';
|
|
4
|
+
import type * as DString from '../string';
|
|
5
|
+
type ComputeMatcher<GenericFact extends DModeling.Fact> = {
|
|
6
|
+
[Fact in GenericFact as DModeling.GetFactName<Fact>]: (value: Fact, payload: DModeling.GetFactPayload<Fact>) => unknown;
|
|
7
|
+
};
|
|
8
|
+
type ForbiddenMoreKey<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>> = DObject.ForbiddenKey<GenericMatcher, Extract<Exclude<keyof GenericMatcher, DModeling.GetFactName<GenericFact>>, string>>;
|
|
9
|
+
type RequireSimpleName<GenericFact extends DModeling.Fact> = DString.RequireSimpleLiteral<DModeling.GetFactName<GenericFact>>;
|
|
10
|
+
export declare function matchWithFact<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericFact>, GenericMatcher>)): (input: GenericFact & RequireSimpleName<GenericFact>) => ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>>;
|
|
11
|
+
export declare function matchWithFact<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>>(input: GenericFact & RequireSimpleName<GenericFact>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<GenericFact, GenericMatcher>)): ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { factKind } from "../modeling/fact/base.mjs";
|
|
2
|
+
//#region scripts/pattern/matchWithFact.ts
|
|
3
|
+
function matchWithFact(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [matcher] = args;
|
|
6
|
+
return (input) => matcher[factKind.getValue(input).name](input);
|
|
7
|
+
}
|
|
8
|
+
const [input, matcher] = args;
|
|
9
|
+
return matcher[factKind.getValue(input).name](input, factKind.getValue(input).payload);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { matchWithFact };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_base = require("../modeling/fact/base.cjs");
|
|
2
|
+
//#region scripts/pattern/matchWithFactOtherwise.ts
|
|
3
|
+
function matchWithFactOtherwise(...args) {
|
|
4
|
+
if (args.length === 2) {
|
|
5
|
+
const [matcher, otherwise] = args;
|
|
6
|
+
return (input) => matchWithFactOtherwise(input, matcher, otherwise);
|
|
7
|
+
}
|
|
8
|
+
const [input, matcher, otherwise] = args;
|
|
9
|
+
const factName = require_base.factKind.getValue(input).name;
|
|
10
|
+
return matcher[factName] === void 0 ? otherwise(input) : matcher[factName](input, require_base.factKind.getValue(input).payload);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.matchWithFactOtherwise = matchWithFactOtherwise;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as DCommon from '../common';
|
|
2
|
+
import * as DModeling from '../modeling';
|
|
3
|
+
import type * as DObject from '../object';
|
|
4
|
+
import type * as DString from '../string';
|
|
5
|
+
type ComputeMatcher<GenericFact extends DModeling.Fact> = {
|
|
6
|
+
[Fact in GenericFact as DModeling.GetFactName<Fact>]?: (value: Fact, payload: DModeling.GetFactPayload<Fact>) => unknown;
|
|
7
|
+
};
|
|
8
|
+
type ForbiddenMoreKey<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>> = DObject.ForbiddenKey<GenericMatcher, Extract<Exclude<keyof GenericMatcher, DModeling.GetFactName<GenericFact>>, string>>;
|
|
9
|
+
type HandledKeys<GenericMatcher extends object> = Extract<DObject.GetPropsWithValueExtends<GenericMatcher, DCommon.AnyFunction>, string>;
|
|
10
|
+
type UnhandledFact<GenericFact extends DModeling.Fact, GenericMatcher extends object> = GenericFact extends DModeling.Fact ? DModeling.GetFactName<GenericFact> extends HandledKeys<GenericMatcher> ? never : GenericFact : never;
|
|
11
|
+
type RequireSimpleName<GenericFact extends DModeling.Fact> = DString.RequireSimpleLiteral<DModeling.GetFactName<GenericFact>>;
|
|
12
|
+
export declare function matchWithFactOtherwise<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericFact>, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledFact<GenericFact, GenericMatcher>>) => GenericOutput): (input: GenericFact & RequireSimpleName<GenericFact>) => (ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
13
|
+
export declare function matchWithFactOtherwise<GenericFact extends DModeling.Fact, GenericMatcher extends ComputeMatcher<GenericFact>, GenericOutput>(input: GenericFact & RequireSimpleName<GenericFact>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericFact>, GenericMatcher> & ForbiddenMoreKey<GenericFact, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledFact<GenericFact, GenericMatcher>>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { factKind } from "../modeling/fact/base.mjs";
|
|
2
|
+
//#region scripts/pattern/matchWithFactOtherwise.ts
|
|
3
|
+
function matchWithFactOtherwise(...args) {
|
|
4
|
+
if (args.length === 2) {
|
|
5
|
+
const [matcher, otherwise] = args;
|
|
6
|
+
return (input) => matchWithFactOtherwise(input, matcher, otherwise);
|
|
7
|
+
}
|
|
8
|
+
const [input, matcher, otherwise] = args;
|
|
9
|
+
const factName = factKind.getValue(input).name;
|
|
10
|
+
return matcher[factName] === void 0 ? otherwise(input) : matcher[factName](input, factKind.getValue(input).payload);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { matchWithFactOtherwise };
|
|
@@ -6,6 +6,6 @@ type ComputeMatcher<GenericInput extends number> = DCommon.SimplifyType<{
|
|
|
6
6
|
}>;
|
|
7
7
|
type ForbiddenMoreKey<GenericInput extends number, GenericMatcher extends ComputeMatcher<GenericInput>> = Exclude<keyof GenericMatcher, GenericInput> extends infer InferredKey ? DCommon.IsEqual<InferredKey, never> extends true ? unknown : DCommon.ComputedTypeError<`Key "${Extract<InferredKey, number>}" is forbidden.`> : never;
|
|
8
8
|
type HandledKeys<GenericMatcher extends object> = Extract<DObject.GetPropsWithValueExtends<GenericMatcher, DCommon.AnyFunction>, number>;
|
|
9
|
-
export declare function matchWithNumberOtherwise<GenericInput extends number, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, number>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: Exclude<GenericInput, HandledKeys<GenericMatcher
|
|
10
|
-
export declare function matchWithNumberOtherwise<GenericInput extends number, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, number>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(input: GenericInput & DNumber.RequireSimpleLiteral<GenericClearInput>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: Exclude<GenericInput, HandledKeys<GenericMatcher
|
|
9
|
+
export declare function matchWithNumberOtherwise<GenericInput extends number, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, number>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<Exclude<GenericInput, HandledKeys<GenericMatcher>>>) => GenericOutput): (input: GenericInput & DNumber.RequireSimpleLiteral<GenericClearInput>) => (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
10
|
+
export declare function matchWithNumberOtherwise<GenericInput extends number, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, number>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(input: GenericInput & DNumber.RequireSimpleLiteral<GenericClearInput>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<Exclude<GenericInput, HandledKeys<GenericMatcher>>>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
11
11
|
export {};
|
|
@@ -6,6 +6,6 @@ type ComputeMatcher<GenericInput extends string> = DCommon.SimplifyType<{
|
|
|
6
6
|
}>;
|
|
7
7
|
type ForbiddenMoreKey<GenericInput extends string, GenericMatcher extends ComputeMatcher<GenericInput>> = DObject.ForbiddenKey<GenericMatcher, Extract<Exclude<keyof GenericMatcher, GenericInput>, string>>;
|
|
8
8
|
type HandledKeys<GenericMatcher extends object> = Extract<DObject.GetPropsWithValueExtends<GenericMatcher, DCommon.AnyFunction>, string>;
|
|
9
|
-
export declare function matchWithStringOtherwise<GenericInput extends string, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, string>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: Exclude<GenericInput, HandledKeys<GenericMatcher
|
|
10
|
-
export declare function matchWithStringOtherwise<GenericInput extends string, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, string>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(input: GenericInput & DString.RequireSimpleLiteral<GenericClearInput>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: Exclude<GenericInput, HandledKeys<GenericMatcher
|
|
9
|
+
export declare function matchWithStringOtherwise<GenericInput extends string, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, string>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<Exclude<GenericInput, HandledKeys<GenericMatcher>>>) => GenericOutput): (input: GenericInput & DString.RequireSimpleLiteral<GenericClearInput>) => (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
10
|
+
export declare function matchWithStringOtherwise<GenericInput extends string, GenericClearInput extends Extract<DCommon.RemoveConstraint<GenericInput>, string>, GenericMatcher extends ComputeMatcher<GenericClearInput>, GenericOutput extends unknown>(input: GenericInput & DString.RequireSimpleLiteral<GenericClearInput>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericClearInput>, GenericMatcher> & ForbiddenMoreKey<GenericClearInput, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<Exclude<GenericInput, HandledKeys<GenericMatcher>>>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
11
11
|
export {};
|
|
@@ -9,6 +9,6 @@ type ForbiddenMoreKey<GenericTaggedObject extends DModeling.ObjectTag, GenericMa
|
|
|
9
9
|
type HandledKeys<GenericMatcher extends object> = Extract<DObject.GetPropsWithValueExtends<GenericMatcher, DCommon.AnyFunction>, string>;
|
|
10
10
|
type UnhandledTaggedObject<GenericTaggedObject extends DModeling.ObjectTag, GenericMatcher extends object> = Exclude<GenericTaggedObject, DModeling.ObjectTag<HandledKeys<GenericMatcher>>>;
|
|
11
11
|
type RequireLiteralTag<GenericTaggedObject extends DModeling.ObjectTag> = DString.RequireSimpleLiteral<DModeling.GetTagValue<GenericTaggedObject>>;
|
|
12
|
-
export declare function matchWithTaggedObjectOtherwise<GenericTaggedObject extends DModeling.ObjectTag, GenericMatcher extends ComputeMatcher<GenericTaggedObject>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericTaggedObject>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericTaggedObject>, GenericMatcher>), otherwise: (value: UnhandledTaggedObject<GenericTaggedObject, GenericMatcher
|
|
13
|
-
export declare function matchWithTaggedObjectOtherwise<GenericTaggedObject extends DModeling.ObjectTag, GenericMatcher extends ComputeMatcher<GenericTaggedObject>, GenericOutput>(input: GenericTaggedObject & RequireLiteralTag<GenericTaggedObject>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericTaggedObject>, GenericMatcher> & ForbiddenMoreKey<GenericTaggedObject, GenericMatcher>), otherwise: (value: UnhandledTaggedObject<GenericTaggedObject, GenericMatcher
|
|
12
|
+
export declare function matchWithTaggedObjectOtherwise<GenericTaggedObject extends DModeling.ObjectTag, GenericMatcher extends ComputeMatcher<GenericTaggedObject>, GenericOutput>(matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericTaggedObject>, GenericMatcher> & ForbiddenMoreKey<NoInfer<GenericTaggedObject>, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledTaggedObject<GenericTaggedObject, GenericMatcher>>) => GenericOutput): (input: GenericTaggedObject & RequireLiteralTag<GenericTaggedObject>) => (ReturnType<Extract<NoInfer<GenericMatcher>[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
13
|
+
export declare function matchWithTaggedObjectOtherwise<GenericTaggedObject extends DModeling.ObjectTag, GenericMatcher extends ComputeMatcher<GenericTaggedObject>, GenericOutput>(input: GenericTaggedObject & RequireLiteralTag<GenericTaggedObject>, matcher: (DCommon.FixDeepFunctionInfer<ComputeMatcher<GenericTaggedObject>, GenericMatcher> & ForbiddenMoreKey<GenericTaggedObject, GenericMatcher>), otherwise: (value: DCommon.BreakGenericLink<UnhandledTaggedObject<GenericTaggedObject, GenericMatcher>>) => GenericOutput): (ReturnType<Extract<GenericMatcher[keyof GenericMatcher], DCommon.AnyFunction>> | GenericOutput);
|
|
14
14
|
export {};
|
|
@@ -19,7 +19,7 @@ export type GetIncompleteUnion<GenericInput extends unknown, GenericPatternValue
|
|
|
19
19
|
[SubProp in Prop]: any;
|
|
20
20
|
}>[Prop]>;
|
|
21
21
|
}> : DCommon.IsEqual<InferredInput, never> extends true ? {} : {
|
|
22
|
-
"@duplojs/
|
|
22
|
+
"@duplojs/lang/{object}": true;
|
|
23
23
|
} : never) | ([
|
|
24
24
|
DTuple.Unmatched<Extract<GenericInput, DCommon.AnyTuple>, Extract<GenericPatternValue, readonly any[]>>,
|
|
25
25
|
Extract<GenericPatternValue, DCommon.AnyTuple | readonly []>
|
|
@@ -33,10 +33,10 @@ export type GetIncompleteUnion<GenericInput extends unknown, GenericPatternValue
|
|
|
33
33
|
readonly [infer InferredInputFirst, ...infer InferredInputRest],
|
|
34
34
|
readonly [infer InferredPatternValueFirst, ...infer InferredPatternValueRest]
|
|
35
35
|
] ? GetIncompleteUnion<InferredInputFirst, InferredPatternValueFirst> extends infer InferredResultFirst ? DObject.FlatObject<{
|
|
36
|
-
"@duplojs/
|
|
37
|
-
"@duplojs/
|
|
36
|
+
"@duplojs/lang/[tuple.first": InferredResultFirst;
|
|
37
|
+
"@duplojs/lang/tuple.rest]": GetIncompleteUnion<InferredInputRest, InferredPatternValueRest>;
|
|
38
38
|
}> : never : never : DCommon.IsEqual<InferredInput, never> extends true ? {} : {
|
|
39
|
-
"@duplojs/
|
|
39
|
+
"@duplojs/lang/[tuple]": true;
|
|
40
40
|
} : never) | ([
|
|
41
41
|
Exclude<Extract<GenericInput, readonly any[]>, DCommon.AnyTuple>,
|
|
42
42
|
Extract<GenericPatternValue, DCommon.AnyTuple>
|
|
@@ -50,8 +50,8 @@ export type GetIncompleteUnion<GenericInput extends unknown, GenericPatternValue
|
|
|
50
50
|
infer InferredPatternValueFirst,
|
|
51
51
|
...infer InferredPatternValueRest
|
|
52
52
|
] ? GetIncompleteUnion<InferredInput[number], InferredPatternValueFirst> extends infer InferredResultFirst ? DObject.FlatObject<{
|
|
53
|
-
"@duplojs/
|
|
54
|
-
"@duplojs/
|
|
53
|
+
"@duplojs/lang/[array.first": InferredResultFirst;
|
|
54
|
+
"@duplojs/lang/array.rest]": DCommon.IsEqual<InferredResultFirst, {}> extends true ? GetIncompleteUnion<InferredInput, InferredPatternValueRest> : never;
|
|
55
55
|
}> : {} : {} : never) | ([
|
|
56
56
|
Exclude<Extract<GenericInput, readonly any[]>, DCommon.AnyTuple>,
|
|
57
57
|
Exclude<Extract<GenericPatternValue, readonly any[]>, DCommon.AnyTuple>
|
|
@@ -62,9 +62,9 @@ export type GetIncompleteUnion<GenericInput extends unknown, GenericPatternValue
|
|
|
62
62
|
DCommon.IsEqual<InferredPatternValue, never>,
|
|
63
63
|
DCommon.IsEqual<InferredInput, never>
|
|
64
64
|
]> extends true ? never : DCommon.IsEqual<Exclude<InferredInput[number], InferredPatternValue[number]>, never> extends true ? {} : {
|
|
65
|
-
"@duplojs/
|
|
65
|
+
"@duplojs/lang/[array]": true;
|
|
66
66
|
} : never) | (Extract<GenericPatternValue, PatternValueMaybeAll> extends infer InferredPatternValue ? DCommon.IsEqual<InferredPatternValue, never> extends true ? never : {
|
|
67
|
-
"@duplojs/
|
|
67
|
+
"@duplojs/lang/{maybeAll}": true;
|
|
68
68
|
} : never) | ([
|
|
69
69
|
Extract<GenericInput, readonly any[]>,
|
|
70
70
|
Extract<GenericPatternValue, readonly []>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReapplyCompatiblesConstraints } from './constraints';
|
|
2
2
|
import type * as DCommon from '../common';
|
|
3
3
|
type CapitalizeOutput<GenericString extends string> = GenericString extends unknown ? ReapplyCompatiblesConstraints<GenericString, Capitalize<Extract<DCommon.RemoveConstraint<GenericString>, string>>, "minCharacters" | "lengthEqual"> : never;
|
|
4
|
-
export declare function capitalize<GenericString extends string
|
|
4
|
+
export declare function capitalize<GenericString extends string>(string: GenericString): CapitalizeOutput<GenericString>;
|
|
5
5
|
export {};
|
package/dist/string/concat.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ type RemoveStringConstraints<GenericStrings extends readonly string[]> = Generic
|
|
|
9
9
|
...RemoveStringConstraints<InferredRest>
|
|
10
10
|
] : string[];
|
|
11
11
|
type ConcatOutput<GenericString extends string, GenericElement extends string, GenericElementsRest extends readonly string[] = []> = ReapplyCompatiblesConstraints<GenericString, `${Extract<DCommon.RemoveConstraint<GenericString>, string>}${Extract<DCommon.RemoveConstraint<GenericElement>, string>}${Join<RemoveStringConstraints<GenericElementsRest>>}`, "minCharacters">;
|
|
12
|
-
export declare function concat<GenericString extends string, GenericElement extends string
|
|
13
|
-
export declare function concat<GenericString extends string, GenericElement extends string, GenericElementsRest extends readonly string[]
|
|
12
|
+
export declare function concat<GenericString extends string, GenericElement extends string>(element: GenericElement): (string: GenericString) => DCommon.BreakGenericLink<ConcatOutput<GenericString, GenericElement>>;
|
|
13
|
+
export declare function concat<GenericString extends string, GenericElement extends string, GenericElementsRest extends readonly string[]>(string: GenericString, element: GenericElement, ...elementsRest: GenericElementsRest): DCommon.BreakGenericLink<ConcatOutput<GenericString, GenericElement, GenericElementsRest>>;
|
|
14
14
|
export {};
|
package/dist/string/prepend.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ type RemoveStringConstraints<GenericStrings extends readonly string[]> = Generic
|
|
|
9
9
|
...RemoveStringConstraints<InferredRest>
|
|
10
10
|
] : string[];
|
|
11
11
|
type PrependOutput<GenericString extends string, GenericElement extends string, GenericElementsRest extends readonly string[] = []> = ReapplyCompatiblesConstraints<GenericString, `${Extract<DCommon.RemoveConstraint<GenericElement>, string>}${Join<RemoveStringConstraints<GenericElementsRest>>}${Extract<DCommon.RemoveConstraint<GenericString>, string>}`, "minCharacters">;
|
|
12
|
-
export declare function prepend<GenericString extends string, GenericElement extends string
|
|
13
|
-
export declare function prepend<GenericString extends string, GenericElement extends string, GenericElementsRest extends readonly string[]
|
|
12
|
+
export declare function prepend<GenericString extends string, GenericElement extends string>(element: GenericElement): (string: GenericString) => PrependOutput<GenericString, GenericElement>;
|
|
13
|
+
export declare function prepend<GenericString extends string, GenericElement extends string, GenericElementsRest extends readonly string[]>(string: GenericString, element: GenericElement, ...elementsRest: GenericElementsRest): PrependOutput<GenericString, GenericElement, GenericElementsRest>;
|
|
14
14
|
export {};
|
package/dist/string/split.cjs
CHANGED
package/dist/string/split.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ type ComputeSplitOutput<GenericString extends string, GenericSeparator extends s
|
|
|
19
19
|
DCommon.IsEqual<GenericString, string>,
|
|
20
20
|
DCommon.IsEqual<GenericSeparator, "">,
|
|
21
21
|
IsKeyPattern<GenericSeparator>
|
|
22
|
-
]> extends true ? string[] & DArray.MinElements<ApplySplitLimit<1, GenericLimit>> : CountSplitGroups<GenericString, GenericSeparator> extends infer InferredGroupNumber extends number ? ApplySplitLimit<InferredGroupNumber, GenericLimit> extends infer InferredOutputLength extends number ? (string[] & DArray.MinElements<InferredOutputLength> & (IsKeyPattern<GenericString> extends true ? unknown : (DArray.LengthEqual<InferredOutputLength> & DArray.MaxElements<InferredOutputLength>))) : never : never;
|
|
22
|
+
]> extends true ? readonly string[] & DArray.MinElements<ApplySplitLimit<1, GenericLimit>> : CountSplitGroups<GenericString, GenericSeparator> extends infer InferredGroupNumber extends number ? ApplySplitLimit<InferredGroupNumber, GenericLimit> extends infer InferredOutputLength extends number ? (readonly string[] & DArray.MinElements<InferredOutputLength> & (IsKeyPattern<GenericString> extends true ? unknown : (DArray.LengthEqual<InferredOutputLength> & DArray.MaxElements<InferredOutputLength>))) : never : never;
|
|
23
23
|
type SplitOutput<GenericString extends string, GenericSeparator extends string, GenericLimit extends number = number> = GenericString extends Format<string> ? ComputeSplitOutput<Extract<DCommon.RemoveConstraint<ApplyFormat<GenericString>>, string>, GenericSeparator, GenericLimit> : ComputeSplitOutput<Extract<DCommon.RemoveConstraint<GenericString>, string>, GenericSeparator, GenericLimit>;
|
|
24
|
-
export declare function split<GenericString extends string, GenericSeparator extends string
|
|
25
|
-
export declare function split<GenericString extends string, GenericSeparator extends string, GenericLimit extends number
|
|
24
|
+
export declare function split<GenericString extends string, GenericSeparator extends string>(separator: GenericSeparator | RegExp): (string: GenericString) => SplitOutput<GenericString, GenericSeparator>;
|
|
25
|
+
export declare function split<GenericString extends string, GenericSeparator extends string, GenericLimit extends number>(string: GenericString, separator: GenericSeparator | RegExp, params?: SplitParams<GenericLimit>): SplitOutput<GenericString, GenericSeparator, GenericLimit>;
|
|
26
26
|
export {};
|
package/dist/string/split.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReapplyCompatiblesConstraints } from './constraints';
|
|
2
2
|
import type * as DCommon from '../common';
|
|
3
3
|
type ToLowerCaseOutput<GenericString extends string> = ReapplyCompatiblesConstraints<GenericString, Lowercase<Extract<DCommon.RemoveConstraint<GenericString>, string>>, "minCharacters">;
|
|
4
|
-
export declare function toLowerCase<GenericString extends string
|
|
4
|
+
export declare function toLowerCase<GenericString extends string>(string: GenericString): ToLowerCaseOutput<GenericString>;
|
|
5
5
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReapplyCompatiblesConstraints } from './constraints';
|
|
2
2
|
import type * as DCommon from '../common';
|
|
3
3
|
type ToUpperCaseOutput<GenericString extends string> = ReapplyCompatiblesConstraints<GenericString, Uppercase<Extract<DCommon.RemoveConstraint<GenericString>, string>>, "minCharacters">;
|
|
4
|
-
export declare function toUpperCase<GenericString extends string
|
|
4
|
+
export declare function toUpperCase<GenericString extends string>(string: GenericString): ToUpperCaseOutput<GenericString>;
|
|
5
5
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { IsLiteral } from './isLiteral';
|
|
2
|
+
type _IsAllowedTail<GenericValue extends string, GenericAllowed extends string> = GenericValue extends `${infer Char}${infer Rest}` ? Char extends GenericAllowed ? _IsAllowedTail<Rest, GenericAllowed> : false : true;
|
|
3
|
+
type _IsAllowedString<GenericValue extends string, GenericAllowed extends string> = GenericValue extends `${infer InferredA}${infer InferredB}${infer InferredC}${infer InferredD}${infer InferredE}${infer InferredF}${infer InferredG}${infer InferredH}${infer InferredRest}` ? (InferredA | InferredB | InferredC | InferredD | InferredE | InferredF | InferredG | InferredH) extends GenericAllowed ? IsAllowedString<InferredRest, GenericAllowed> : false : _IsAllowedTail<GenericValue, GenericAllowed>;
|
|
4
|
+
export type IsAllowedString<GenericValue extends string, GenericAllowed extends string> = IsLiteral<GenericValue> extends true ? _IsAllowedString<GenericValue, GenericAllowed> : false;
|
|
3
5
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReapplyCompatiblesConstraints } from './constraints';
|
|
2
2
|
import type * as DCommon from '../common';
|
|
3
3
|
type UncapitalizeOutput<GenericString extends string> = ReapplyCompatiblesConstraints<GenericString, Uncapitalize<Extract<DCommon.RemoveConstraint<GenericString>, string>>, "minCharacters">;
|
|
4
|
-
export declare function uncapitalize<GenericString extends string
|
|
4
|
+
export declare function uncapitalize<GenericString extends string>(string: GenericString): UncapitalizeOutput<GenericString>;
|
|
5
5
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type Map<GenericArray extends readonly unknown[], GenericOutput extends unknown> = GenericArray extends readonly [] ? [] : GenericArray extends readonly [infer _InferredFirst, ...infer InferredRest] ? Map<InferredRest, GenericOutput> extends infer InferredResult extends readonly any[] ? [GenericOutput, ...InferredResult] : never : GenericOutput[];
|
|
1
|
+
export type Map<GenericArray extends readonly unknown[], GenericOutput extends unknown> = GenericArray extends readonly [] ? readonly [] : GenericArray extends readonly [infer _InferredFirst, ...infer InferredRest] ? Map<InferredRest, GenericOutput> extends infer InferredResult extends readonly any[] ? readonly [GenericOutput, ...InferredResult] : never : readonly GenericOutput[];
|