@duplojs/utils 1.4.44 → 1.4.46

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.
Files changed (131) hide show
  1. package/dist/clean/constraint/base.d.ts +5 -5
  2. package/dist/clean/constraint/defaultConstraint/number.d.ts +3 -3
  3. package/dist/clean/constraint/defaultConstraint/string.d.ts +2 -2
  4. package/dist/clean/entity.d.ts +2 -2
  5. package/dist/clean/flag.d.ts +1 -1
  6. package/dist/clean/newType.d.ts +5 -5
  7. package/dist/clean/primitive/base.d.ts +10 -10
  8. package/dist/clean/repository.d.ts +1 -1
  9. package/dist/clean/useCase.d.ts +1 -1
  10. package/dist/common/hasKinds.d.ts +3 -3
  11. package/dist/common/hasSomeKinds.d.ts +3 -3
  12. package/dist/common/path/resolveFrom.d.ts +1 -1
  13. package/dist/dataParser/base.d.ts +2 -2
  14. package/dist/dataParser/baseExtended.d.ts +2 -2
  15. package/dist/dataParser/extended/empty.d.ts +1 -1
  16. package/dist/dataParser/extended/nullable.d.ts +1 -1
  17. package/dist/dataParser/extended/optional.d.ts +1 -1
  18. package/dist/dataParser/extended/recover.d.ts +1 -1
  19. package/dist/dataParser/parsers/array/index.d.ts +1 -1
  20. package/dist/dataParser/parsers/empty.d.ts +1 -1
  21. package/dist/dataParser/parsers/lazy.d.ts +1 -1
  22. package/dist/dataParser/parsers/literal.d.ts +1 -1
  23. package/dist/dataParser/parsers/nullable.d.ts +2 -2
  24. package/dist/dataParser/parsers/object/index.d.ts +3 -3
  25. package/dist/dataParser/parsers/optional.d.ts +3 -3
  26. package/dist/dataParser/parsers/pipe.d.ts +1 -1
  27. package/dist/dataParser/parsers/record/index.d.ts +1 -1
  28. package/dist/dataParser/parsers/recover.d.ts +3 -3
  29. package/dist/dataParser/parsers/templateLiteral/index.d.ts +1 -1
  30. package/dist/dataParser/parsers/transform.d.ts +1 -1
  31. package/dist/dataParser/parsers/tuple.d.ts +1 -1
  32. package/dist/dataParser/parsers/union.d.ts +1 -1
  33. package/dist/date/create.d.ts +1 -1
  34. package/dist/date/createTime.d.ts +1 -1
  35. package/dist/either/bool/base.cjs +6 -1
  36. package/dist/either/bool/base.d.ts +4 -0
  37. package/dist/either/bool/base.mjs +6 -2
  38. package/dist/either/bool/create.d.ts +6 -6
  39. package/dist/either/bool/falsy.cjs +9 -4
  40. package/dist/either/bool/falsy.d.ts +23 -15
  41. package/dist/either/bool/falsy.mjs +10 -6
  42. package/dist/either/bool/truthy.cjs +9 -4
  43. package/dist/either/bool/truthy.d.ts +23 -15
  44. package/dist/either/bool/truthy.mjs +10 -6
  45. package/dist/either/future/base.cjs +6 -1
  46. package/dist/either/future/base.d.ts +4 -0
  47. package/dist/either/future/base.mjs +6 -2
  48. package/dist/either/future/create.d.ts +8 -8
  49. package/dist/either/future/error.cjs +7 -2
  50. package/dist/either/future/error.d.ts +15 -7
  51. package/dist/either/future/error.mjs +8 -4
  52. package/dist/either/future/success.cjs +7 -2
  53. package/dist/either/future/success.d.ts +15 -7
  54. package/dist/either/future/success.mjs +8 -4
  55. package/dist/either/hasInformation.cjs +2 -2
  56. package/dist/either/hasInformation.d.ts +8 -8
  57. package/dist/either/hasInformation.mjs +3 -3
  58. package/dist/either/index.cjs +24 -0
  59. package/dist/either/index.mjs +23 -23
  60. package/dist/either/kind.cjs +6 -1
  61. package/dist/either/kind.d.ts +4 -0
  62. package/dist/either/kind.mjs +6 -2
  63. package/dist/either/left/create.cjs +7 -2
  64. package/dist/either/left/create.d.ts +14 -6
  65. package/dist/either/left/create.mjs +8 -4
  66. package/dist/either/left/error.cjs +7 -2
  67. package/dist/either/left/error.d.ts +14 -6
  68. package/dist/either/left/error.mjs +7 -3
  69. package/dist/either/left/fail.cjs +7 -2
  70. package/dist/either/left/fail.d.ts +14 -6
  71. package/dist/either/left/fail.mjs +7 -3
  72. package/dist/either/left/is.cjs +2 -2
  73. package/dist/either/left/is.d.ts +4 -4
  74. package/dist/either/left/is.mjs +4 -4
  75. package/dist/either/left/when.d.ts +4 -4
  76. package/dist/either/nullable/base.cjs +6 -1
  77. package/dist/either/nullable/base.d.ts +4 -0
  78. package/dist/either/nullable/base.mjs +6 -2
  79. package/dist/either/nullable/create.d.ts +5 -5
  80. package/dist/either/nullable/empty.cjs +9 -4
  81. package/dist/either/nullable/empty.d.ts +23 -15
  82. package/dist/either/nullable/empty.mjs +10 -6
  83. package/dist/either/nullable/filled.cjs +9 -4
  84. package/dist/either/nullable/filled.d.ts +22 -14
  85. package/dist/either/nullable/filled.mjs +10 -6
  86. package/dist/either/nullish/base.cjs +6 -1
  87. package/dist/either/nullish/base.d.ts +4 -0
  88. package/dist/either/nullish/base.mjs +6 -2
  89. package/dist/either/nullish/create.d.ts +5 -5
  90. package/dist/either/nullish/empty.cjs +9 -4
  91. package/dist/either/nullish/empty.d.ts +23 -15
  92. package/dist/either/nullish/empty.mjs +10 -6
  93. package/dist/either/nullish/filled.cjs +9 -4
  94. package/dist/either/nullish/filled.d.ts +23 -15
  95. package/dist/either/nullish/filled.mjs +10 -6
  96. package/dist/either/optional/base.cjs +6 -1
  97. package/dist/either/optional/base.d.ts +4 -0
  98. package/dist/either/optional/base.mjs +6 -2
  99. package/dist/either/optional/create.d.ts +5 -5
  100. package/dist/either/optional/empty.cjs +9 -4
  101. package/dist/either/optional/empty.d.ts +23 -15
  102. package/dist/either/optional/empty.mjs +10 -6
  103. package/dist/either/optional/filled.cjs +9 -4
  104. package/dist/either/optional/filled.d.ts +22 -14
  105. package/dist/either/optional/filled.mjs +10 -6
  106. package/dist/either/right/asyncGroup.d.ts +7 -7
  107. package/dist/either/right/asyncPipe.d.ts +33 -25
  108. package/dist/either/right/create.cjs +7 -2
  109. package/dist/either/right/create.d.ts +15 -7
  110. package/dist/either/right/create.mjs +8 -4
  111. package/dist/either/right/group.d.ts +8 -8
  112. package/dist/either/right/is.cjs +2 -2
  113. package/dist/either/right/is.d.ts +4 -4
  114. package/dist/either/right/is.mjs +4 -4
  115. package/dist/either/right/ok.cjs +7 -2
  116. package/dist/either/right/ok.d.ts +14 -6
  117. package/dist/either/right/ok.mjs +7 -3
  118. package/dist/either/right/pipe.d.ts +32 -24
  119. package/dist/either/right/success.cjs +7 -2
  120. package/dist/either/right/success.d.ts +14 -6
  121. package/dist/either/right/success.mjs +7 -3
  122. package/dist/either/right/when.d.ts +4 -4
  123. package/dist/either/safeCallback.cjs +14 -4
  124. package/dist/either/safeCallback.d.ts +33 -17
  125. package/dist/either/safeCallback.mjs +13 -5
  126. package/dist/either/whenHasInformation.cjs +1 -1
  127. package/dist/either/whenHasInformation.d.ts +7 -7
  128. package/dist/either/whenHasInformation.mjs +2 -2
  129. package/dist/string/isIn.d.ts +2 -2
  130. package/dist/string/slice.d.ts +1 -1
  131. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { type Kind } from "../common";
2
- import { type EitherLeft } from "./left";
3
- import { type EitherRight } from "./right";
4
- import { eitherInformationKind } from "./kind";
5
- type Either = EitherRight | EitherLeft;
2
+ import { type Left } from "./left";
3
+ import { type Right } from "./right";
4
+ import { informationKind } from "./kind";
5
+ type Either = Right | Left;
6
6
  /**
7
7
  * Type guard based on the literal information stored in the Either. Lets you precisely target a business case without extra introspection.
8
8
  *
@@ -20,10 +20,10 @@ type Either = EitherRight | EitherLeft;
20
20
  * : E.left("left-3", 3);
21
21
  *
22
22
  * if (E.isLeft(result)) {
23
- * // type: E.EitherLeft<"left-2", 2> | E.EitherLeft<"left-3", 3>
23
+ * // type: E.Left<"left-2", 2> | E.Left<"left-3", 3>
24
24
  *
25
25
  * if (E.hasInformation(result, "left-2")) {
26
- * // type: E.EitherLeft<"left-2", 2>
26
+ * // type: E.Left<"left-2", 2>
27
27
  * }
28
28
  * }
29
29
  * ```
@@ -33,6 +33,6 @@ type Either = EitherRight | EitherLeft;
33
33
  * @namespace E
34
34
  *
35
35
  */
36
- export declare function hasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never)>(information: GenericInformation): (input: GenericInput) => input is Extract<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
37
- export declare function hasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never)>(input: GenericInput, information: GenericInformation): input is Extract<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
36
+ export declare function hasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof informationKind.getValue<GenericInput>> : never)>(information: GenericInformation): (input: GenericInput) => input is Extract<GenericInput, Kind<typeof informationKind.definition, GenericInformation>>;
37
+ export declare function hasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof informationKind.getValue<GenericInput>> : never)>(input: GenericInput, information: GenericInformation): input is Extract<GenericInput, Kind<typeof informationKind.definition, GenericInformation>>;
38
38
  export {};
@@ -1,4 +1,4 @@
1
- import { eitherInformationKind } from './kind.mjs';
1
+ import { informationKind } from './kind.mjs';
2
2
 
3
3
  function hasInformation(...args) {
4
4
  if (args.length === 1) {
@@ -6,8 +6,8 @@ function hasInformation(...args) {
6
6
  return (input) => hasInformation(input, information);
7
7
  }
8
8
  const [input, information] = args;
9
- return eitherInformationKind.has(input)
10
- && eitherInformationKind.getValue(input) === information;
9
+ return informationKind.has(input)
10
+ && informationKind.getValue(input) === information;
11
11
  }
12
12
 
13
13
  export { hasInformation };
@@ -47,75 +47,99 @@ exports.hasInformation = hasInformation.hasInformation;
47
47
  exports.whenHasInformation = whenHasInformation.whenHasInformation;
48
48
  exports.createEitherKind = kind.createEitherKind;
49
49
  exports.eitherInformationKind = kind.eitherInformationKind;
50
+ exports.informationKind = kind.informationKind;
50
51
  exports.callbackError = safeCallback.callbackError;
52
+ exports.callbackErrorKind = safeCallback.callbackErrorKind;
51
53
  exports.callbackSuccess = safeCallback.callbackSuccess;
54
+ exports.callbackSuccessKind = safeCallback.callbackSuccessKind;
52
55
  exports.eitherCallbackErrorKind = safeCallback.eitherCallbackErrorKind;
53
56
  exports.eitherCallbackSuccessKind = safeCallback.eitherCallbackSuccessKind;
54
57
  exports.safeCallback = safeCallback.safeCallback;
55
58
  exports.bool = create.bool;
56
59
  exports.boolFalsy = falsy.boolFalsy;
60
+ exports.boolFalsyKind = falsy.boolFalsyKind;
57
61
  exports.eitherBoolFalsyKind = falsy.eitherBoolFalsyKind;
58
62
  exports.isBoolFalsy = falsy.isBoolFalsy;
59
63
  exports.whenIsBoolFalsy = falsy.whenIsBoolFalsy;
60
64
  exports.boolTruthy = truthy.boolTruthy;
65
+ exports.boolTruthyKind = truthy.boolTruthyKind;
61
66
  exports.eitherBoolTruthyKind = truthy.eitherBoolTruthyKind;
62
67
  exports.isBoolTruthy = truthy.isBoolTruthy;
63
68
  exports.whenIsBoolTruthy = truthy.whenIsBoolTruthy;
69
+ exports.boolKind = base.boolKind;
64
70
  exports.eitherBoolKind = base.eitherBoolKind;
65
71
  exports.Future = create$1.Future;
66
72
  exports.future = create$1.future;
67
73
  exports.eitherFutureErrorKind = error.eitherFutureErrorKind;
68
74
  exports.futureError = error.futureError;
75
+ exports.futureErrorKind = error.futureErrorKind;
69
76
  exports.eitherFutureSuccessKind = success.eitherFutureSuccessKind;
70
77
  exports.futureSuccess = success.futureSuccess;
78
+ exports.futureSuccessKind = success.futureSuccessKind;
71
79
  exports.eitherFutureKind = base$1.eitherFutureKind;
80
+ exports.futureKind = base$1.futureKind;
72
81
  exports.eitherLeftKind = create$2.eitherLeftKind;
73
82
  exports.left = create$2.left;
83
+ exports.leftKind = create$2.leftKind;
74
84
  exports.eitherErrorKind = error$1.eitherErrorKind;
75
85
  exports.error = error$1.error;
86
+ exports.errorKind = error$1.errorKind;
76
87
  exports.eitherFailKind = fail.eitherFailKind;
77
88
  exports.fail = fail.fail;
89
+ exports.failKind = fail.failKind;
78
90
  exports.isLeft = is.isLeft;
79
91
  exports.whenIsLeft = when.whenIsLeft;
80
92
  exports.nullable = create$3.nullable;
81
93
  exports.eitherNullableEmptyKind = empty.eitherNullableEmptyKind;
82
94
  exports.isNullableEmpty = empty.isNullableEmpty;
83
95
  exports.nullableEmpty = empty.nullableEmpty;
96
+ exports.nullableEmptyKind = empty.nullableEmptyKind;
84
97
  exports.whenIsNullableEmpty = empty.whenIsNullableEmpty;
85
98
  exports.eitherNullableFilledKind = filled.eitherNullableFilledKind;
86
99
  exports.isNullableFilled = filled.isNullableFilled;
87
100
  exports.nullableFilled = filled.nullableFilled;
101
+ exports.nullableFilledKind = filled.nullableFilledKind;
88
102
  exports.whenIsNullableFilled = filled.whenIsNullableFilled;
89
103
  exports.eitherNullableKind = base$2.eitherNullableKind;
104
+ exports.nullableKind = base$2.nullableKind;
90
105
  exports.nullish = create$4.nullish;
91
106
  exports.eitherNullishEmptyKind = empty$1.eitherNullishEmptyKind;
92
107
  exports.isNullishEmpty = empty$1.isNullishEmpty;
93
108
  exports.nullishEmpty = empty$1.nullishEmpty;
109
+ exports.nullishEmptyKind = empty$1.nullishEmptyKind;
94
110
  exports.whenIsNullishEmpty = empty$1.whenIsNullishEmpty;
95
111
  exports.eitherNullishFilledKind = filled$1.eitherNullishFilledKind;
96
112
  exports.isNullishFilled = filled$1.isNullishFilled;
97
113
  exports.nullishFilled = filled$1.nullishFilled;
114
+ exports.nullishFilledKind = filled$1.nullishFilledKind;
98
115
  exports.whenIsNullishFilled = filled$1.whenIsNullishFilled;
99
116
  exports.eitherNullishKind = base$3.eitherNullishKind;
117
+ exports.nullishKind = base$3.nullishKind;
100
118
  exports.optional = create$5.optional;
101
119
  exports.eitherOptionalEmptyKind = empty$2.eitherOptionalEmptyKind;
102
120
  exports.isOptionalEmpty = empty$2.isOptionalEmpty;
103
121
  exports.optionalEmpty = empty$2.optionalEmpty;
122
+ exports.optionalEmptyKind = empty$2.optionalEmptyKind;
104
123
  exports.whenIsOptionalEmpty = empty$2.whenIsOptionalEmpty;
105
124
  exports.eitherOptionalFilledKind = filled$2.eitherOptionalFilledKind;
106
125
  exports.isOptionalFilled = filled$2.isOptionalFilled;
107
126
  exports.optionalFilled = filled$2.optionalFilled;
127
+ exports.optionalFilledKind = filled$2.optionalFilledKind;
108
128
  exports.whenIsOptionalFilled = filled$2.whenIsOptionalFilled;
109
129
  exports.eitherOptionalKind = base$4.eitherOptionalKind;
130
+ exports.optionalKind = base$4.optionalKind;
110
131
  exports.rightAsyncPipe = asyncPipe.rightAsyncPipe;
111
132
  exports.eitherRightKind = create$6.eitherRightKind;
112
133
  exports.right = create$6.right;
134
+ exports.rightKind = create$6.rightKind;
113
135
  exports.isRight = is$1.isRight;
114
136
  exports.eitherOkKind = ok.eitherOkKind;
115
137
  exports.ok = ok.ok;
138
+ exports.okKind = ok.okKind;
116
139
  exports.rightPipe = pipe.rightPipe;
117
140
  exports.eitherSuccessKind = success$1.eitherSuccessKind;
118
141
  exports.success = success$1.success;
142
+ exports.successKind = success$1.successKind;
119
143
  exports.whenIsRight = when$1.whenIsRight;
120
144
  exports.group = group.group;
121
145
  exports.asyncGroup = asyncGroup.asyncGroup;
@@ -1,38 +1,38 @@
1
1
  export { hasInformation } from './hasInformation.mjs';
2
2
  export { whenHasInformation } from './whenHasInformation.mjs';
3
- export { createEitherKind, eitherInformationKind } from './kind.mjs';
4
- export { callbackError, callbackSuccess, eitherCallbackErrorKind, eitherCallbackSuccessKind, safeCallback } from './safeCallback.mjs';
3
+ export { createEitherKind, eitherInformationKind, informationKind } from './kind.mjs';
4
+ export { callbackError, callbackErrorKind, callbackSuccess, callbackSuccessKind, eitherCallbackErrorKind, eitherCallbackSuccessKind, safeCallback } from './safeCallback.mjs';
5
5
  export { bool } from './bool/create.mjs';
6
- export { boolFalsy, eitherBoolFalsyKind, isBoolFalsy, whenIsBoolFalsy } from './bool/falsy.mjs';
7
- export { boolTruthy, eitherBoolTruthyKind, isBoolTruthy, whenIsBoolTruthy } from './bool/truthy.mjs';
8
- export { eitherBoolKind } from './bool/base.mjs';
6
+ export { boolFalsy, boolFalsyKind, eitherBoolFalsyKind, isBoolFalsy, whenIsBoolFalsy } from './bool/falsy.mjs';
7
+ export { boolTruthy, boolTruthyKind, eitherBoolTruthyKind, isBoolTruthy, whenIsBoolTruthy } from './bool/truthy.mjs';
8
+ export { boolKind, eitherBoolKind } from './bool/base.mjs';
9
9
  export { Future, future } from './future/create.mjs';
10
- export { eitherFutureErrorKind, futureError } from './future/error.mjs';
11
- export { eitherFutureSuccessKind, futureSuccess } from './future/success.mjs';
12
- export { eitherFutureKind } from './future/base.mjs';
13
- export { eitherLeftKind, left } from './left/create.mjs';
14
- export { eitherErrorKind, error } from './left/error.mjs';
15
- export { eitherFailKind, fail } from './left/fail.mjs';
10
+ export { eitherFutureErrorKind, futureError, futureErrorKind } from './future/error.mjs';
11
+ export { eitherFutureSuccessKind, futureSuccess, futureSuccessKind } from './future/success.mjs';
12
+ export { eitherFutureKind, futureKind } from './future/base.mjs';
13
+ export { eitherLeftKind, left, leftKind } from './left/create.mjs';
14
+ export { eitherErrorKind, error, errorKind } from './left/error.mjs';
15
+ export { eitherFailKind, fail, failKind } from './left/fail.mjs';
16
16
  export { isLeft } from './left/is.mjs';
17
17
  export { whenIsLeft } from './left/when.mjs';
18
18
  export { nullable } from './nullable/create.mjs';
19
- export { eitherNullableEmptyKind, isNullableEmpty, nullableEmpty, whenIsNullableEmpty } from './nullable/empty.mjs';
20
- export { eitherNullableFilledKind, isNullableFilled, nullableFilled, whenIsNullableFilled } from './nullable/filled.mjs';
21
- export { eitherNullableKind } from './nullable/base.mjs';
19
+ export { eitherNullableEmptyKind, isNullableEmpty, nullableEmpty, nullableEmptyKind, whenIsNullableEmpty } from './nullable/empty.mjs';
20
+ export { eitherNullableFilledKind, isNullableFilled, nullableFilled, nullableFilledKind, whenIsNullableFilled } from './nullable/filled.mjs';
21
+ export { eitherNullableKind, nullableKind } from './nullable/base.mjs';
22
22
  export { nullish } from './nullish/create.mjs';
23
- export { eitherNullishEmptyKind, isNullishEmpty, nullishEmpty, whenIsNullishEmpty } from './nullish/empty.mjs';
24
- export { eitherNullishFilledKind, isNullishFilled, nullishFilled, whenIsNullishFilled } from './nullish/filled.mjs';
25
- export { eitherNullishKind } from './nullish/base.mjs';
23
+ export { eitherNullishEmptyKind, isNullishEmpty, nullishEmpty, nullishEmptyKind, whenIsNullishEmpty } from './nullish/empty.mjs';
24
+ export { eitherNullishFilledKind, isNullishFilled, nullishFilled, nullishFilledKind, whenIsNullishFilled } from './nullish/filled.mjs';
25
+ export { eitherNullishKind, nullishKind } from './nullish/base.mjs';
26
26
  export { optional } from './optional/create.mjs';
27
- export { eitherOptionalEmptyKind, isOptionalEmpty, optionalEmpty, whenIsOptionalEmpty } from './optional/empty.mjs';
28
- export { eitherOptionalFilledKind, isOptionalFilled, optionalFilled, whenIsOptionalFilled } from './optional/filled.mjs';
29
- export { eitherOptionalKind } from './optional/base.mjs';
27
+ export { eitherOptionalEmptyKind, isOptionalEmpty, optionalEmpty, optionalEmptyKind, whenIsOptionalEmpty } from './optional/empty.mjs';
28
+ export { eitherOptionalFilledKind, isOptionalFilled, optionalFilled, optionalFilledKind, whenIsOptionalFilled } from './optional/filled.mjs';
29
+ export { eitherOptionalKind, optionalKind } from './optional/base.mjs';
30
30
  export { rightAsyncPipe } from './right/asyncPipe.mjs';
31
- export { eitherRightKind, right } from './right/create.mjs';
31
+ export { eitherRightKind, right, rightKind } from './right/create.mjs';
32
32
  export { isRight } from './right/is.mjs';
33
- export { eitherOkKind, ok } from './right/ok.mjs';
33
+ export { eitherOkKind, ok, okKind } from './right/ok.mjs';
34
34
  export { rightPipe } from './right/pipe.mjs';
35
- export { eitherSuccessKind, success } from './right/success.mjs';
35
+ export { eitherSuccessKind, success, successKind } from './right/success.mjs';
36
36
  export { whenIsRight } from './right/when.mjs';
37
37
  export { group } from './right/group.mjs';
38
38
  export { asyncGroup } from './right/asyncGroup.mjs';
@@ -5,7 +5,12 @@ var kind = require('../common/kind.cjs');
5
5
  const createEitherKind = kind.createKindNamespace(
6
6
  // @ts-expect-error reserved kind namespace
7
7
  "DuplojsUtilsEither");
8
- const eitherInformationKind = createEitherKind("information");
8
+ const informationKind = createEitherKind("information");
9
+ /**
10
+ * @deprecated use informationKind
11
+ */
12
+ const eitherInformationKind = informationKind;
9
13
 
10
14
  exports.createEitherKind = createEitherKind;
11
15
  exports.eitherInformationKind = eitherInformationKind;
16
+ exports.informationKind = informationKind;
@@ -1,2 +1,6 @@
1
1
  export declare const createEitherKind: <GenericName extends string, GenericKindValue extends unknown = unknown>(name: GenericName & import("../string").ForbiddenString<GenericName, "@" | "/">) => import("../common").KindHandler<import("../common").KindDefinition<`@DuplojsUtilsEither/${GenericName}`, GenericKindValue>>;
2
+ export declare const informationKind: import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsEither/information", string>>;
3
+ /**
4
+ * @deprecated use informationKind
5
+ */
2
6
  export declare const eitherInformationKind: import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsEither/information", string>>;
@@ -3,6 +3,10 @@ import { createKindNamespace } from '../common/kind.mjs';
3
3
  const createEitherKind = createKindNamespace(
4
4
  // @ts-expect-error reserved kind namespace
5
5
  "DuplojsUtilsEither");
6
- const eitherInformationKind = createEitherKind("information");
6
+ const informationKind = createEitherKind("information");
7
+ /**
8
+ * @deprecated use informationKind
9
+ */
10
+ const eitherInformationKind = informationKind;
7
11
 
8
- export { createEitherKind, eitherInformationKind };
12
+ export { createEitherKind, eitherInformationKind, informationKind };
@@ -3,13 +3,18 @@
3
3
  var wrapValue = require('../../common/wrapValue.cjs');
4
4
  var kind = require('../kind.cjs');
5
5
 
6
- const eitherLeftKind = kind.createEitherKind("left");
6
+ const leftKind = kind.createEitherKind("left");
7
+ /**
8
+ * @deprecated use leftKind
9
+ */
10
+ const eitherLeftKind = leftKind;
7
11
  /**
8
12
  * {@include either/left/index.md}
9
13
  */
10
14
  function left(information, value = undefined) {
11
- return eitherLeftKind.setTo(kind.eitherInformationKind.setTo(wrapValue.wrapValue(value), information));
15
+ return leftKind.setTo(kind.informationKind.setTo(wrapValue.wrapValue(value), information));
12
16
  }
13
17
 
14
18
  exports.eitherLeftKind = eitherLeftKind;
15
19
  exports.left = left;
20
+ exports.leftKind = leftKind;
@@ -1,12 +1,20 @@
1
1
  import { type Kind } from "../../common/kind";
2
2
  import { type WrappedValue } from "../../common/wrapValue";
3
- import { eitherInformationKind } from "../kind";
3
+ import { informationKind } from "../kind";
4
+ export declare const leftKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/left", unknown>>;
5
+ /**
6
+ * @deprecated use leftKind
7
+ */
4
8
  export declare const eitherLeftKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/left", unknown>>;
5
- type _EitherLeft<GenericInformation extends string = string, GenericValue extends unknown = unknown> = (Kind<typeof eitherLeftKind.definition> & Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue<GenericValue>);
6
- export interface EitherLeft<GenericInformation extends string = string, GenericValue extends unknown = unknown> extends _EitherLeft<GenericInformation, GenericValue> {
9
+ type _Left<GenericInformation extends string = string, GenericValue extends unknown = unknown> = (Kind<typeof leftKind.definition> & Kind<typeof informationKind.definition, GenericInformation> & WrappedValue<GenericValue>);
10
+ export interface Left<GenericInformation extends string = string, GenericValue extends unknown = unknown> extends _Left<GenericInformation, GenericValue> {
7
11
  }
8
12
  /**
9
- * Builds an EitherLeft by associating mandatory business information (literal string) with a value representing the error. This is the fundamental brick to signal a contextualized failure.
13
+ * @deprecated use Left
14
+ */
15
+ export type EitherLeft<GenericInformation extends string = string, GenericValue extends unknown = unknown> = Left<GenericInformation, GenericValue>;
16
+ /**
17
+ * Builds an Left by associating mandatory business information (literal string) with a value representing the error. This is the fundamental brick to signal a contextualized failure.
10
18
  *
11
19
  * Signature: `left(information, value)` → returns a value
12
20
  *
@@ -26,7 +34,7 @@ export interface EitherLeft<GenericInformation extends string = string, GenericV
26
34
  * ),
27
35
  * );
28
36
  *
29
- * // type: E.EitherRight<"number.positive", number> | E.EitherLeft<"number.notPositive", number>
37
+ * // type: E.Right<"number.positive", number> | E.Left<"number.notPositive", number>
30
38
  * ```
31
39
  *
32
40
  * @see https://utils.duplojs.dev/en/v1/api/either/left
@@ -34,5 +42,5 @@ export interface EitherLeft<GenericInformation extends string = string, GenericV
34
42
  * @namespace E
35
43
  *
36
44
  */
37
- export declare function left<GenericInformation extends string, const GenericValue extends unknown = undefined>(information: GenericInformation, value?: GenericValue): EitherLeft<GenericInformation, GenericValue>;
45
+ export declare function left<GenericInformation extends string, const GenericValue extends unknown = undefined>(information: GenericInformation, value?: GenericValue): Left<GenericInformation, GenericValue>;
38
46
  export {};
@@ -1,12 +1,16 @@
1
1
  import { wrapValue } from '../../common/wrapValue.mjs';
2
- import { createEitherKind, eitherInformationKind } from '../kind.mjs';
2
+ import { createEitherKind, informationKind } from '../kind.mjs';
3
3
 
4
- const eitherLeftKind = createEitherKind("left");
4
+ const leftKind = createEitherKind("left");
5
+ /**
6
+ * @deprecated use leftKind
7
+ */
8
+ const eitherLeftKind = leftKind;
5
9
  /**
6
10
  * {@include either/left/index.md}
7
11
  */
8
12
  function left(information, value = undefined) {
9
- return eitherLeftKind.setTo(eitherInformationKind.setTo(wrapValue(value), information));
13
+ return leftKind.setTo(informationKind.setTo(wrapValue(value), information));
10
14
  }
11
15
 
12
- export { eitherLeftKind, left };
16
+ export { eitherLeftKind, left, leftKind };
@@ -3,13 +3,18 @@
3
3
  var kind = require('../kind.cjs');
4
4
  var create = require('./create.cjs');
5
5
 
6
- const eitherErrorKind = kind.createEitherKind("error");
6
+ const errorKind = kind.createEitherKind("error");
7
+ /**
8
+ * @deprecated use errorKind
9
+ */
10
+ const eitherErrorKind = errorKind;
7
11
  /**
8
12
  * {@include either/error/index.md}
9
13
  */
10
14
  function error(value) {
11
- return eitherErrorKind.setTo(create.left("error", value));
15
+ return errorKind.setTo(create.left("error", value));
12
16
  }
13
17
 
14
18
  exports.eitherErrorKind = eitherErrorKind;
15
19
  exports.error = error;
20
+ exports.errorKind = errorKind;
@@ -1,11 +1,19 @@
1
1
  import { type Kind } from "../../common/kind";
2
- import { type EitherLeft } from "./create";
2
+ import { type Left } from "./create";
3
+ export declare const errorKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/error", unknown>>;
4
+ /**
5
+ * @deprecated use errorKind
6
+ */
3
7
  export declare const eitherErrorKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/error", unknown>>;
4
- type _EitherError<GenericValue extends unknown = unknown> = (EitherLeft<"error", GenericValue> & Kind<typeof eitherErrorKind.definition>);
5
- export interface EitherError<GenericValue extends unknown = unknown> extends _EitherError<GenericValue> {
8
+ type _Error<GenericValue extends unknown = unknown> = (Left<"error", GenericValue> & Kind<typeof errorKind.definition>);
9
+ export interface Error<GenericValue extends unknown = unknown> extends _Error<GenericValue> {
6
10
  }
7
11
  /**
8
- * Handy alias to create an EitherLeft with the info fixed to "error". Useful to signal a generic error without manually providing the info.
12
+ * @deprecated use Error
13
+ */
14
+ export type EitherError<GenericValue extends unknown = unknown> = Error<GenericValue>;
15
+ /**
16
+ * Handy alias to create an Left with the info fixed to "error". Useful to signal a generic error without manually providing the info.
9
17
  *
10
18
  * Signature: `error(value)` → returns a value
11
19
  *
@@ -24,7 +32,7 @@ export interface EitherError<GenericValue extends unknown = unknown> extends _Ei
24
32
  * ),
25
33
  * );
26
34
  *
27
- * // type: E.EitherError<string> | E.EitherSuccess<string>
35
+ * // type: E.Error<string> | E.Success<string>
28
36
  * ```
29
37
  *
30
38
  * @see https://utils.duplojs.dev/en/v1/api/either/error
@@ -32,5 +40,5 @@ export interface EitherError<GenericValue extends unknown = unknown> extends _Ei
32
40
  * @namespace E
33
41
  *
34
42
  */
35
- export declare function error<const GenericValue extends unknown>(value: GenericValue): EitherError<GenericValue>;
43
+ export declare function error<const GenericValue extends unknown>(value: GenericValue): Error<GenericValue>;
36
44
  export {};
@@ -1,12 +1,16 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
2
  import { left } from './create.mjs';
3
3
 
4
- const eitherErrorKind = createEitherKind("error");
4
+ const errorKind = createEitherKind("error");
5
+ /**
6
+ * @deprecated use errorKind
7
+ */
8
+ const eitherErrorKind = errorKind;
5
9
  /**
6
10
  * {@include either/error/index.md}
7
11
  */
8
12
  function error(value) {
9
- return eitherErrorKind.setTo(left("error", value));
13
+ return errorKind.setTo(left("error", value));
10
14
  }
11
15
 
12
- export { eitherErrorKind, error };
16
+ export { eitherErrorKind, error, errorKind };
@@ -3,13 +3,18 @@
3
3
  var kind = require('../kind.cjs');
4
4
  var create = require('./create.cjs');
5
5
 
6
- const eitherFailKind = kind.createEitherKind("fail");
6
+ const failKind = kind.createEitherKind("fail");
7
+ /**
8
+ * @deprecated use failKind
9
+ */
10
+ const eitherFailKind = failKind;
7
11
  /**
8
12
  * {@include either/fail/index.md}
9
13
  */
10
14
  function fail() {
11
- return eitherFailKind.setTo(create.left("fail", undefined));
15
+ return failKind.setTo(create.left("fail", undefined));
12
16
  }
13
17
 
14
18
  exports.eitherFailKind = eitherFailKind;
15
19
  exports.fail = fail;
20
+ exports.failKind = failKind;
@@ -1,11 +1,19 @@
1
1
  import { type Kind } from "../../common/kind";
2
- import { type EitherLeft } from "./create";
2
+ import { type Left } from "./create";
3
+ export declare const failKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/fail", unknown>>;
4
+ /**
5
+ * @deprecated use failKind
6
+ */
3
7
  export declare const eitherFailKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/fail", unknown>>;
4
- type _EitherFail = (EitherLeft<"fail", never> & Kind<typeof eitherFailKind.definition>);
5
- export interface EitherFail extends _EitherFail {
8
+ type _Fail = (Left<"fail", never> & Kind<typeof failKind.definition>);
9
+ export interface Fail extends _Fail {
6
10
  }
7
11
  /**
8
- * Returns an EitherLeft<"fail", never>: perfect to signal a failure without carrying extra data.
12
+ * @deprecated use Fail
13
+ */
14
+ export type EitherFail = Fail;
15
+ /**
16
+ * Returns an Left<"fail", never>: perfect to signal a failure without carrying extra data.
9
17
  *
10
18
  * Signature: `fail()` → returns a value
11
19
  *
@@ -25,7 +33,7 @@ export interface EitherFail extends _EitherFail {
25
33
  * ),
26
34
  * );
27
35
  *
28
- * // type: E.EitherSuccess<number> | E.EitherFail
36
+ * // type: E.Success<number> | E.Fail
29
37
  * ```
30
38
  *
31
39
  * @see https://utils.duplojs.dev/en/v1/api/either/fail
@@ -33,5 +41,5 @@ export interface EitherFail extends _EitherFail {
33
41
  * @namespace E
34
42
  *
35
43
  */
36
- export declare function fail(): EitherFail;
44
+ export declare function fail(): Fail;
37
45
  export {};
@@ -1,12 +1,16 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
2
  import { left } from './create.mjs';
3
3
 
4
- const eitherFailKind = createEitherKind("fail");
4
+ const failKind = createEitherKind("fail");
5
+ /**
6
+ * @deprecated use failKind
7
+ */
8
+ const eitherFailKind = failKind;
5
9
  /**
6
10
  * {@include either/fail/index.md}
7
11
  */
8
12
  function fail() {
9
- return eitherFailKind.setTo(left("fail", undefined));
13
+ return failKind.setTo(left("fail", undefined));
10
14
  }
11
15
 
12
- export { eitherFailKind, fail };
16
+ export { eitherFailKind, fail, failKind };
@@ -8,8 +8,8 @@ var kind = require('../kind.cjs');
8
8
  * {@include either/isLeft/index.md}
9
9
  */
10
10
  function isLeft(input) {
11
- return create.eitherLeftKind.has(input)
12
- && kind.eitherInformationKind.has(input)
11
+ return create.leftKind.has(input)
12
+ && kind.informationKind.has(input)
13
13
  && wrapValue.isWrappedValue(input);
14
14
  }
15
15
 
@@ -1,6 +1,6 @@
1
- import { type EitherLeft } from "./create";
1
+ import { type Left } from "./create";
2
2
  /**
3
- * Type guard that checks whether a value is an EitherLeft. Ideal to secure an unwrap or trigger an error branch.
3
+ * Type guard that checks whether a value is an Left. Ideal to secure an unwrap or trigger an error branch.
4
4
  *
5
5
  * Signature: `isLeft(input)` → returns a value
6
6
  *
@@ -12,7 +12,7 @@ import { type EitherLeft } from "./create";
12
12
  * : E.fail();
13
13
  *
14
14
  * if (E.isLeft(result)) {
15
- * // type: E.EitherFail
15
+ * // type: E.Fail
16
16
  * }
17
17
  * ```
18
18
  *
@@ -21,4 +21,4 @@ import { type EitherLeft } from "./create";
21
21
  * @namespace E
22
22
  *
23
23
  */
24
- export declare function isLeft<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, EitherLeft>;
24
+ export declare function isLeft<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, Left>;
@@ -1,13 +1,13 @@
1
- import { eitherLeftKind } from './create.mjs';
1
+ import { leftKind } from './create.mjs';
2
2
  import { isWrappedValue } from '../../common/wrapValue.mjs';
3
- import { eitherInformationKind } from '../kind.mjs';
3
+ import { informationKind } from '../kind.mjs';
4
4
 
5
5
  /**
6
6
  * {@include either/isLeft/index.md}
7
7
  */
8
8
  function isLeft(input) {
9
- return eitherLeftKind.has(input)
10
- && eitherInformationKind.has(input)
9
+ return leftKind.has(input)
10
+ && informationKind.has(input)
11
11
  && isWrappedValue(input);
12
12
  }
13
13
 
@@ -1,7 +1,7 @@
1
1
  import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
2
- import { type EitherLeft } from "./create";
2
+ import { type Left } from "./create";
3
3
  /**
4
- * Executes a function only when the input is an EitherLeft. Otherwise, the original value is returned as-is.
4
+ * Executes a function only when the input is an Left. Otherwise, the original value is returned as-is.
5
5
  *
6
6
  * **Supported call styles:**
7
7
  * - Classic: `whenIsLeft(input, theFunction)` → returns a value
@@ -26,5 +26,5 @@ import { type EitherLeft } from "./create";
26
26
  * @namespace E
27
27
  *
28
28
  */
29
- export declare function whenIsLeft<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, EitherLeft>>) => GenericOutput): (input: GenericInput) => Exclude<BreakGenericLink<GenericInput>, EitherLeft> | GenericOutput;
30
- export declare function whenIsLeft<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, EitherLeft>>) => GenericOutput): Exclude<GenericInput, EitherLeft> | GenericOutput;
29
+ export declare function whenIsLeft<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, Left>>) => GenericOutput): (input: GenericInput) => Exclude<BreakGenericLink<GenericInput>, Left> | GenericOutput;
30
+ export declare function whenIsLeft<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, Left>>) => GenericOutput): Exclude<GenericInput, Left> | GenericOutput;
@@ -2,6 +2,11 @@
2
2
 
3
3
  var kind = require('../kind.cjs');
4
4
 
5
- const eitherNullableKind = kind.createEitherKind("nullable");
5
+ const nullableKind = kind.createEitherKind("nullable");
6
+ /**
7
+ * @deprecated use nullableKind
8
+ */
9
+ const eitherNullableKind = nullableKind;
6
10
 
7
11
  exports.eitherNullableKind = eitherNullableKind;
12
+ exports.nullableKind = nullableKind;
@@ -1 +1,5 @@
1
+ export declare const nullableKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/nullable", unknown>>;
2
+ /**
3
+ * @deprecated use nullableKind
4
+ */
1
5
  export declare const eitherNullableKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/nullable", unknown>>;
@@ -1,5 +1,9 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
2
 
3
- const eitherNullableKind = createEitherKind("nullable");
3
+ const nullableKind = createEitherKind("nullable");
4
+ /**
5
+ * @deprecated use nullableKind
6
+ */
7
+ const eitherNullableKind = nullableKind;
4
8
 
5
- export { eitherNullableKind };
9
+ export { eitherNullableKind, nullableKind };