@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,15 +1,23 @@
1
- import { type EitherRight } from "../right";
2
- import { type EitherLeft } from "../left";
1
+ import { type Right } from "../right";
2
+ import { type Left } from "../left";
3
3
  import { nullish } from "./create";
4
4
  import { type Kind } from "../../common/kind";
5
5
  import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
6
- import { eitherNullishKind } from "./base";
6
+ import { nullishKind } from "./base";
7
+ export declare const nullishFilledKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/nullish-filled", unknown>>;
8
+ /**
9
+ * @deprecated use nullishFilledKind
10
+ */
7
11
  export declare const eitherNullishFilledKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/nullish-filled", unknown>>;
8
- type _EitherNullishFilled<GenericValue extends unknown = unknown> = (EitherRight<"nullish", GenericValue> & Kind<typeof eitherNullishKind.definition> & Kind<typeof eitherNullishFilledKind.definition>);
9
- export interface EitherNullishFilled<GenericValue extends unknown = unknown> extends _EitherNullishFilled<GenericValue> {
12
+ type _NullishFilled<GenericValue extends unknown = unknown> = (Right<"nullish", GenericValue> & Kind<typeof nullishKind.definition> & Kind<typeof nullishFilledKind.definition>);
13
+ export interface NullishFilled<GenericValue extends unknown = unknown> extends _NullishFilled<GenericValue> {
10
14
  }
11
15
  /**
12
- * Type guard that detects an EitherNullishFilled.
16
+ * @deprecated use NullishFilled
17
+ */
18
+ export type EitherNullishFilled<GenericValue extends unknown = unknown> = NullishFilled<GenericValue>;
19
+ /**
20
+ * Type guard that detects an NullishFilled.
13
21
  *
14
22
  * Signature: `isNullishFilled(input)` → returns a value
15
23
  *
@@ -19,7 +27,7 @@ export interface EitherNullishFilled<GenericValue extends unknown = unknown> ext
19
27
  * const maybeValue = E.nullish(true ? "value" : null);
20
28
  *
21
29
  * if (E.isNullishFilled(maybeValue)) {
22
- * // type: E.EitherNullishFilled<"value">
30
+ * // type: E.NullishFilled<"value">
23
31
  * }
24
32
  * ```
25
33
  *
@@ -29,7 +37,7 @@ export interface EitherNullishFilled<GenericValue extends unknown = unknown> ext
29
37
  *
30
38
  */
31
39
  /**
32
- * Builds an EitherRight<"nullish"> with a non-null/non-undefined value.
40
+ * Builds an Right<"nullish"> with a non-null/non-undefined value.
33
41
  *
34
42
  * Signature: `nullishFilled(value)` → returns a value
35
43
  *
@@ -38,7 +46,7 @@ export interface EitherNullishFilled<GenericValue extends unknown = unknown> ext
38
46
  * ```ts
39
47
  * const result = E.nullishFilled("string");
40
48
  *
41
- * // type: E.EitherNullishFilled<"string">
49
+ * // type: E.NullishFilled<"string">
42
50
  * ```
43
51
  *
44
52
  * @see https://utils.duplojs.dev/en/v1/api/either/nullishFilled
@@ -61,7 +69,7 @@ export interface EitherNullishFilled<GenericValue extends unknown = unknown> ext
61
69
  * E.whenIsNullishFilled(S.toUpperCase),
62
70
  * );
63
71
  *
64
- * // type: E.EitherNullishEmpty<null> | "VALUE"
72
+ * // type: E.NullishEmpty<null> | "VALUE"
65
73
  * ```
66
74
  *
67
75
  * @see https://utils.duplojs.dev/en/v1/api/either/whenIsNullishFilled
@@ -69,10 +77,10 @@ export interface EitherNullishFilled<GenericValue extends unknown = unknown> ext
69
77
  * @namespace E
70
78
  *
71
79
  */
72
- export declare function nullishFilled<const GenericValue extends unknown>(value: GenericValue): EitherNullishFilled<GenericValue>;
73
- type Either = EitherRight | EitherLeft;
74
- export declare function isNullishFilled<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, EitherNullishFilled>;
80
+ export declare function nullishFilled<const GenericValue extends unknown>(value: GenericValue): NullishFilled<GenericValue>;
81
+ type Either = Right | Left;
82
+ export declare function isNullishFilled<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, NullishFilled>;
75
83
  type ToEither<GenericValue extends unknown> = GenericValue extends Either ? GenericValue : ReturnType<typeof nullish<GenericValue>>;
76
- export declare function whenIsNullishFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, EitherNullishFilled>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToEither<BreakGenericLink<GenericInput>>, EitherNullishFilled>;
77
- export declare function whenIsNullishFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, EitherNullishFilled>>) => GenericOutput): GenericOutput | Exclude<ToEither<GenericInput>, EitherNullishFilled>;
84
+ export declare function whenIsNullishFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, NullishFilled>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToEither<BreakGenericLink<GenericInput>>, NullishFilled>;
85
+ export declare function whenIsNullishFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, NullishFilled>>) => GenericOutput): GenericOutput | Exclude<ToEither<GenericInput>, NullishFilled>;
78
86
  export {};
@@ -1,12 +1,16 @@
1
1
  import { nullish } from './create.mjs';
2
2
  import { createEitherKind } from '../kind.mjs';
3
- import { eitherNullishKind } from './base.mjs';
3
+ import { nullishKind } from './base.mjs';
4
4
  import { right } from '../right/create.mjs';
5
5
  import { isRight } from '../right/is.mjs';
6
6
  import { isLeft } from '../left/is.mjs';
7
7
  import { unwrap } from '../../common/unwrap.mjs';
8
8
 
9
- const eitherNullishFilledKind = createEitherKind("nullish-filled");
9
+ const nullishFilledKind = createEitherKind("nullish-filled");
10
+ /**
11
+ * @deprecated use nullishFilledKind
12
+ */
13
+ const eitherNullishFilledKind = nullishFilledKind;
10
14
  /**
11
15
  * {@include either/isNullishFilled/index.md}
12
16
  */
@@ -17,12 +21,12 @@ const eitherNullishFilledKind = createEitherKind("nullish-filled");
17
21
  * {@include either/whenIsNullishFilled/index.md}
18
22
  */
19
23
  function nullishFilled(value) {
20
- return eitherNullishKind.setTo(eitherNullishFilledKind.setTo(right("nullish", value)));
24
+ return nullishKind.setTo(nullishFilledKind.setTo(right("nullish", value)));
21
25
  }
22
26
  function isNullishFilled(input) {
23
27
  return isRight(input)
24
- && eitherNullishKind.has(input)
25
- && eitherNullishKind.has(input);
28
+ && nullishKind.has(input)
29
+ && nullishFilledKind.has(input);
26
30
  }
27
31
  function whenIsNullishFilled(...args) {
28
32
  if (args.length === 1) {
@@ -45,4 +49,4 @@ function whenIsNullishFilled(...args) {
45
49
  return either;
46
50
  }
47
51
 
48
- export { eitherNullishFilledKind, isNullishFilled, nullishFilled, whenIsNullishFilled };
52
+ export { eitherNullishFilledKind, isNullishFilled, nullishFilled, nullishFilledKind, whenIsNullishFilled };
@@ -2,6 +2,11 @@
2
2
 
3
3
  var kind = require('../kind.cjs');
4
4
 
5
- const eitherOptionalKind = kind.createEitherKind("optional");
5
+ const optionalKind = kind.createEitherKind("optional");
6
+ /**
7
+ * @deprecated use optionalKind
8
+ */
9
+ const eitherOptionalKind = optionalKind;
6
10
 
7
11
  exports.eitherOptionalKind = eitherOptionalKind;
12
+ exports.optionalKind = optionalKind;
@@ -1 +1,5 @@
1
+ export declare const optionalKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/optional", unknown>>;
2
+ /**
3
+ * @deprecated use optionalKind
4
+ */
1
5
  export declare const eitherOptionalKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/optional", unknown>>;
@@ -1,5 +1,9 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
2
 
3
- const eitherOptionalKind = createEitherKind("optional");
3
+ const optionalKind = createEitherKind("optional");
4
+ /**
5
+ * @deprecated use optionalKind
6
+ */
7
+ const eitherOptionalKind = optionalKind;
4
8
 
5
- export { eitherOptionalKind };
9
+ export { eitherOptionalKind, optionalKind };
@@ -1,5 +1,5 @@
1
- import { type EitherOptionalEmpty } from "./empty";
2
- import { type EitherOptionalFilled } from "./filled";
1
+ import { type OptionalEmpty } from "./empty";
2
+ import { type OptionalFilled } from "./filled";
3
3
  /**
4
4
  * Wraps an undefined/defined value in an Either, useful for propagating optional fields.
5
5
  *
@@ -10,7 +10,7 @@ import { type EitherOptionalFilled } from "./filled";
10
10
  * ```ts
11
11
  * const result = E.optional(true ? "value" : undefined);
12
12
  *
13
- * // type: E.EitherOptionalEmpty | E.EitherOptionalFilled<"value">
13
+ * // type: E.OptionalEmpty | E.OptionalFilled<"value">
14
14
  * ```
15
15
  *
16
16
  * @see https://utils.duplojs.dev/en/v1/api/either/optional
@@ -18,5 +18,5 @@ import { type EitherOptionalFilled } from "./filled";
18
18
  * @namespace E
19
19
  *
20
20
  */
21
- export declare function optional<const GenericValue extends unknown = undefined>(value: GenericValue): GenericValue extends undefined ? EitherOptionalEmpty : EitherOptionalFilled<GenericValue>;
22
- export type Optional<GenericValue extends unknown> = EitherOptionalFilled<GenericValue> | EitherOptionalEmpty;
21
+ export declare function optional<const GenericValue extends unknown = undefined>(value: GenericValue): GenericValue extends undefined ? OptionalEmpty : OptionalFilled<GenericValue>;
22
+ export type Optional<GenericValue extends unknown> = OptionalFilled<GenericValue> | OptionalEmpty;
@@ -7,7 +7,11 @@ var create = require('../left/create.cjs');
7
7
  var is = require('../left/is.cjs');
8
8
  var is$1 = require('../right/is.cjs');
9
9
 
10
- const eitherOptionalEmptyKind = kind.createEitherKind("optional-empty");
10
+ const optionalEmptyKind = kind.createEitherKind("optional-empty");
11
+ /**
12
+ * @deprecated use optionalEmptyKind
13
+ */
14
+ const eitherOptionalEmptyKind = optionalEmptyKind;
11
15
  /**
12
16
  * {@include either/isOptionalEmpty/index.md}
13
17
  */
@@ -18,12 +22,12 @@ const eitherOptionalEmptyKind = kind.createEitherKind("optional-empty");
18
22
  * {@include either/whenIsOptionalEmpty/index.md}
19
23
  */
20
24
  function optionalEmpty() {
21
- return base.eitherOptionalKind.setTo(eitherOptionalEmptyKind.setTo(create.left("optional", undefined)));
25
+ return base.optionalKind.setTo(optionalEmptyKind.setTo(create.left("optional", undefined)));
22
26
  }
23
27
  function isOptionalEmpty(input) {
24
28
  return is.isLeft(input)
25
- && base.eitherOptionalKind.has(input)
26
- && eitherOptionalEmptyKind.has(input);
29
+ && base.optionalKind.has(input)
30
+ && optionalEmptyKind.has(input);
27
31
  }
28
32
  function whenIsOptionalEmpty(...args) {
29
33
  if (args.length === 1) {
@@ -49,4 +53,5 @@ function whenIsOptionalEmpty(...args) {
49
53
  exports.eitherOptionalEmptyKind = eitherOptionalEmptyKind;
50
54
  exports.isOptionalEmpty = isOptionalEmpty;
51
55
  exports.optionalEmpty = optionalEmpty;
56
+ exports.optionalEmptyKind = optionalEmptyKind;
52
57
  exports.whenIsOptionalEmpty = whenIsOptionalEmpty;
@@ -1,16 +1,24 @@
1
1
  import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
2
2
  import { type Kind } from "../../common/kind";
3
- import { eitherOptionalKind } from "./base";
3
+ import { optionalKind } from "./base";
4
4
  import { optional } from "./create";
5
- import { type EitherLeft } from "../left";
6
- import { type EitherRight } from "../right";
5
+ import { type Left } from "../left";
6
+ import { type Right } from "../right";
7
+ export declare const optionalEmptyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/optional-empty", unknown>>;
8
+ /**
9
+ * @deprecated use optionalEmptyKind
10
+ */
7
11
  export declare const eitherOptionalEmptyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/optional-empty", unknown>>;
8
- type _EitherOptionalEmpty = (EitherLeft<"optional", undefined> & Kind<typeof eitherOptionalKind.definition> & Kind<typeof eitherOptionalEmptyKind.definition>);
9
- export interface EitherOptionalEmpty extends _EitherOptionalEmpty {
12
+ type _OptionalEmpty = (Left<"optional", undefined> & Kind<typeof optionalKind.definition> & Kind<typeof optionalEmptyKind.definition>);
13
+ export interface OptionalEmpty extends _OptionalEmpty {
10
14
  }
11
- type Either = EitherRight | EitherLeft;
12
15
  /**
13
- * Type guard that detects an EitherOptionalEmpty.
16
+ * @deprecated use OptionalEmpty
17
+ */
18
+ export type EitherOptionalEmpty = OptionalEmpty;
19
+ type Either = Right | Left;
20
+ /**
21
+ * Type guard that detects an OptionalEmpty.
14
22
  *
15
23
  * Signature: `isOptionalEmpty(input)` → returns a value
16
24
  *
@@ -20,7 +28,7 @@ type Either = EitherRight | EitherLeft;
20
28
  * const maybeValue = E.optional(true ? "value" : undefined);
21
29
  *
22
30
  * if (E.isOptionalEmpty(maybeValue)) {
23
- * // type: E.EitherOptionalEmpty
31
+ * // type: E.OptionalEmpty
24
32
  * }
25
33
  * ```
26
34
  *
@@ -30,14 +38,14 @@ type Either = EitherRight | EitherLeft;
30
38
  *
31
39
  */
32
40
  /**
33
- * Builds an EitherLeft<"optional"> containing undefined.
41
+ * Builds an Left<"optional"> containing undefined.
34
42
  *
35
43
  * Signature: `optionalEmpty()` → returns a value
36
44
  *
37
45
  * ```ts
38
46
  * const result = E.optionalEmpty();
39
47
  *
40
- * // type: E.EitherOptionalEmpty
48
+ * // type: E.OptionalEmpty
41
49
  * ```
42
50
  *
43
51
  * @see https://utils.duplojs.dev/en/v1/api/either/optionalEmpty
@@ -60,7 +68,7 @@ type Either = EitherRight | EitherLeft;
60
68
  * E.whenIsOptionalEmpty(() => "empty"),
61
69
  * );
62
70
  *
63
- * // type: E.EitherOptionalFilled<"value"> | "empty"
71
+ * // type: E.OptionalFilled<"value"> | "empty"
64
72
  * ```
65
73
  *
66
74
  * @see https://utils.duplojs.dev/en/v1/api/either/whenIsOptionalEmpty
@@ -68,9 +76,9 @@ type Either = EitherRight | EitherLeft;
68
76
  * @namespace E
69
77
  *
70
78
  */
71
- export declare function optionalEmpty(): EitherOptionalEmpty;
72
- export declare function isOptionalEmpty<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, EitherOptionalEmpty>;
79
+ export declare function optionalEmpty(): OptionalEmpty;
80
+ export declare function isOptionalEmpty<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, OptionalEmpty>;
73
81
  type ToOptionalEither<GenericValue extends unknown> = GenericValue extends Either ? GenericValue : ReturnType<typeof optional<GenericValue>>;
74
- export declare function whenIsOptionalEmpty<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, EitherOptionalEmpty>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToOptionalEither<BreakGenericLink<GenericInput>>, EitherOptionalEmpty>;
75
- export declare function whenIsOptionalEmpty<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, EitherOptionalEmpty>>) => GenericOutput): GenericOutput | Exclude<ToOptionalEither<GenericInput>, EitherOptionalEmpty>;
82
+ export declare function whenIsOptionalEmpty<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, OptionalEmpty>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToOptionalEither<BreakGenericLink<GenericInput>>, OptionalEmpty>;
83
+ export declare function whenIsOptionalEmpty<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, OptionalEmpty>>) => GenericOutput): GenericOutput | Exclude<ToOptionalEither<GenericInput>, OptionalEmpty>;
76
84
  export {};
@@ -1,11 +1,15 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
- import { eitherOptionalKind } from './base.mjs';
2
+ import { optionalKind } from './base.mjs';
3
3
  import { optional } from './create.mjs';
4
4
  import { left } from '../left/create.mjs';
5
5
  import { isLeft } from '../left/is.mjs';
6
6
  import { isRight } from '../right/is.mjs';
7
7
 
8
- const eitherOptionalEmptyKind = createEitherKind("optional-empty");
8
+ const optionalEmptyKind = createEitherKind("optional-empty");
9
+ /**
10
+ * @deprecated use optionalEmptyKind
11
+ */
12
+ const eitherOptionalEmptyKind = optionalEmptyKind;
9
13
  /**
10
14
  * {@include either/isOptionalEmpty/index.md}
11
15
  */
@@ -16,12 +20,12 @@ const eitherOptionalEmptyKind = createEitherKind("optional-empty");
16
20
  * {@include either/whenIsOptionalEmpty/index.md}
17
21
  */
18
22
  function optionalEmpty() {
19
- return eitherOptionalKind.setTo(eitherOptionalEmptyKind.setTo(left("optional", undefined)));
23
+ return optionalKind.setTo(optionalEmptyKind.setTo(left("optional", undefined)));
20
24
  }
21
25
  function isOptionalEmpty(input) {
22
26
  return isLeft(input)
23
- && eitherOptionalKind.has(input)
24
- && eitherOptionalEmptyKind.has(input);
27
+ && optionalKind.has(input)
28
+ && optionalEmptyKind.has(input);
25
29
  }
26
30
  function whenIsOptionalEmpty(...args) {
27
31
  if (args.length === 1) {
@@ -44,4 +48,4 @@ function whenIsOptionalEmpty(...args) {
44
48
  return either;
45
49
  }
46
50
 
47
- export { eitherOptionalEmptyKind, isOptionalEmpty, optionalEmpty, whenIsOptionalEmpty };
51
+ export { eitherOptionalEmptyKind, isOptionalEmpty, optionalEmpty, optionalEmptyKind, whenIsOptionalEmpty };
@@ -8,7 +8,11 @@ var is = require('../right/is.cjs');
8
8
  var is$1 = require('../left/is.cjs');
9
9
  var unwrap = require('../../common/unwrap.cjs');
10
10
 
11
- const eitherOptionalFilledKind = kind.createEitherKind("optional-filled");
11
+ const optionalFilledKind = kind.createEitherKind("optional-filled");
12
+ /**
13
+ * @deprecated use optionalFilledKind
14
+ */
15
+ const eitherOptionalFilledKind = optionalFilledKind;
12
16
  /**
13
17
  * {@include either/isOptionalFilled/index.md}
14
18
  */
@@ -19,12 +23,12 @@ const eitherOptionalFilledKind = kind.createEitherKind("optional-filled");
19
23
  * {@include either/whenIsOptionalFilled/index.md}
20
24
  */
21
25
  function optionalFilled(value) {
22
- return base.eitherOptionalKind.setTo(eitherOptionalFilledKind.setTo(create.right("optional", value)));
26
+ return base.optionalKind.setTo(optionalFilledKind.setTo(create.right("optional", value)));
23
27
  }
24
28
  function isOptionalFilled(input) {
25
29
  return is.isRight(input)
26
- && base.eitherOptionalKind.has(input)
27
- && eitherOptionalFilledKind.has(input);
30
+ && base.optionalKind.has(input)
31
+ && optionalFilledKind.has(input);
28
32
  }
29
33
  function whenIsOptionalFilled(...args) {
30
34
  if (args.length === 1) {
@@ -50,4 +54,5 @@ function whenIsOptionalFilled(...args) {
50
54
  exports.eitherOptionalFilledKind = eitherOptionalFilledKind;
51
55
  exports.isOptionalFilled = isOptionalFilled;
52
56
  exports.optionalFilled = optionalFilled;
57
+ exports.optionalFilledKind = optionalFilledKind;
53
58
  exports.whenIsOptionalFilled = whenIsOptionalFilled;
@@ -1,14 +1,22 @@
1
1
  import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
2
2
  import { type Kind } from "../../common/kind";
3
- import { eitherOptionalKind } from "./base";
3
+ import { optionalKind } from "./base";
4
4
  import { optional } from "./create";
5
- import { type EitherLeft } from "../left";
6
- import { type EitherRight } from "../right";
5
+ import { type Left } from "../left";
6
+ import { type Right } from "../right";
7
+ export declare const optionalFilledKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/optional-filled", unknown>>;
8
+ /**
9
+ * @deprecated use optionalFilledKind
10
+ */
7
11
  export declare const eitherOptionalFilledKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/optional-filled", unknown>>;
8
- type _EitherOptionalFilled<GenericValue extends unknown = unknown> = (EitherRight<"optional", GenericValue> & Kind<typeof eitherOptionalKind.definition> & Kind<typeof eitherOptionalFilledKind.definition>);
9
- export interface EitherOptionalFilled<GenericValue extends unknown = unknown> extends _EitherOptionalFilled<GenericValue> {
12
+ type _OptionalFilled<GenericValue extends unknown = unknown> = (Right<"optional", GenericValue> & Kind<typeof optionalKind.definition> & Kind<typeof optionalFilledKind.definition>);
13
+ export interface OptionalFilled<GenericValue extends unknown = unknown> extends _OptionalFilled<GenericValue> {
10
14
  }
11
- type Either = EitherRight | EitherLeft;
15
+ /**
16
+ * @deprecated use OptionalFilled
17
+ */
18
+ export type EitherOptionalFilled<GenericValue extends unknown = unknown> = OptionalFilled<GenericValue>;
19
+ type Either = Right | Left;
12
20
  /**
13
21
  * Type guard that checks that an optional contains a value.
14
22
  *
@@ -20,7 +28,7 @@ type Either = EitherRight | EitherLeft;
20
28
  * const maybeValue = E.optional(true ? "value" : undefined);
21
29
  *
22
30
  * if (E.isOptionalFilled(maybeValue)) {
23
- * // type: E.EitherOptionalFilled<"value">
31
+ * // type: E.OptionalFilled<"value">
24
32
  * }
25
33
  * ```
26
34
  *
@@ -30,7 +38,7 @@ type Either = EitherRight | EitherLeft;
30
38
  *
31
39
  */
32
40
  /**
33
- * Builds an EitherRight<"optional"> when the value is defined.
41
+ * Builds an Right<"optional"> when the value is defined.
34
42
  *
35
43
  * Signature: `optionalFilled(value)` → returns a value
36
44
  *
@@ -39,7 +47,7 @@ type Either = EitherRight | EitherLeft;
39
47
  * ```ts
40
48
  * const result = E.optionalFilled("value");
41
49
  *
42
- * // type: E.EitherOptionalFilled<"value">
50
+ * // type: E.OptionalFilled<"value">
43
51
  * ```
44
52
  *
45
53
  * @see https://utils.duplojs.dev/en/v1/api/either/optionalFilled
@@ -62,7 +70,7 @@ type Either = EitherRight | EitherLeft;
62
70
  * E.whenIsOptionalFilled(S.capitalize),
63
71
  * );
64
72
  *
65
- * // type: E.EitherOptionalEmpty | "Value"
73
+ * // type: E.OptionalEmpty | "Value"
66
74
  * ```
67
75
  *
68
76
  * @see https://utils.duplojs.dev/en/v1/api/either/whenIsOptionalFilled
@@ -70,9 +78,9 @@ type Either = EitherRight | EitherLeft;
70
78
  * @namespace E
71
79
  *
72
80
  */
73
- export declare function optionalFilled<const GenericValue extends unknown>(value: GenericValue): EitherOptionalFilled<GenericValue>;
74
- export declare function isOptionalFilled<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, EitherOptionalFilled>;
81
+ export declare function optionalFilled<const GenericValue extends unknown>(value: GenericValue): OptionalFilled<GenericValue>;
82
+ export declare function isOptionalFilled<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, OptionalFilled>;
75
83
  type ToOptionalEither<GenericValue extends unknown> = GenericValue extends Either ? GenericValue : ReturnType<typeof optional<GenericValue>>;
76
- export declare function whenIsOptionalFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, EitherOptionalFilled>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToOptionalEither<BreakGenericLink<GenericInput>>, EitherOptionalFilled>;
77
- export declare function whenIsOptionalFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, EitherOptionalFilled>>) => GenericOutput): GenericOutput | Exclude<ToOptionalEither<GenericInput>, EitherOptionalFilled>;
84
+ export declare function whenIsOptionalFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, OptionalFilled>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToOptionalEither<BreakGenericLink<GenericInput>>, OptionalFilled>;
85
+ export declare function whenIsOptionalFilled<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToOptionalEither<BreakGenericLink<GenericInput>>, OptionalFilled>>) => GenericOutput): GenericOutput | Exclude<ToOptionalEither<GenericInput>, OptionalFilled>;
78
86
  export {};
@@ -1,12 +1,16 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
- import { eitherOptionalKind } from './base.mjs';
2
+ import { optionalKind } from './base.mjs';
3
3
  import { optional } from './create.mjs';
4
4
  import { right } from '../right/create.mjs';
5
5
  import { isRight } from '../right/is.mjs';
6
6
  import { isLeft } from '../left/is.mjs';
7
7
  import { unwrap } from '../../common/unwrap.mjs';
8
8
 
9
- const eitherOptionalFilledKind = createEitherKind("optional-filled");
9
+ const optionalFilledKind = createEitherKind("optional-filled");
10
+ /**
11
+ * @deprecated use optionalFilledKind
12
+ */
13
+ const eitherOptionalFilledKind = optionalFilledKind;
10
14
  /**
11
15
  * {@include either/isOptionalFilled/index.md}
12
16
  */
@@ -17,12 +21,12 @@ const eitherOptionalFilledKind = createEitherKind("optional-filled");
17
21
  * {@include either/whenIsOptionalFilled/index.md}
18
22
  */
19
23
  function optionalFilled(value) {
20
- return eitherOptionalKind.setTo(eitherOptionalFilledKind.setTo(right("optional", value)));
24
+ return optionalKind.setTo(optionalFilledKind.setTo(right("optional", value)));
21
25
  }
22
26
  function isOptionalFilled(input) {
23
27
  return isRight(input)
24
- && eitherOptionalKind.has(input)
25
- && eitherOptionalFilledKind.has(input);
28
+ && optionalKind.has(input)
29
+ && optionalFilledKind.has(input);
26
30
  }
27
31
  function whenIsOptionalFilled(...args) {
28
32
  if (args.length === 1) {
@@ -45,4 +49,4 @@ function whenIsOptionalFilled(...args) {
45
49
  return either;
46
50
  }
47
51
 
48
- export { eitherOptionalFilledKind, isOptionalFilled, optionalFilled, whenIsOptionalFilled };
52
+ export { eitherOptionalFilledKind, isOptionalFilled, optionalFilled, optionalFilledKind, whenIsOptionalFilled };
@@ -1,12 +1,12 @@
1
1
  import { type AnyFunction, type SimplifyTopLevel, type MayBeGetter, type Unwrap, type MaybePromise } from "../../common";
2
- import { type EitherLeft } from "../left";
3
- import { type EitherRight } from "./create";
2
+ import { type Left } from "../left";
3
+ import { type Right } from "./create";
4
4
  import * as DEither from "..";
5
- type Either = MaybePromise<EitherRight | EitherLeft>;
6
- type ComputeResult<GenericGroup extends Record<string, MayBeGetter<Either>>> = Promise<DEither.EitherSuccess<SimplifyTopLevel<{
7
- [Prop in keyof GenericGroup]: GenericGroup[Prop] extends AnyFunction ? Unwrap<Extract<Awaited<ReturnType<GenericGroup[Prop]>>, EitherRight>> : Unwrap<Extract<Awaited<GenericGroup[Prop]>, EitherRight>>;
5
+ type Either = MaybePromise<Right | Left>;
6
+ type ComputeResult<GenericGroup extends Record<string, MayBeGetter<Either>>> = Promise<DEither.Success<SimplifyTopLevel<{
7
+ [Prop in keyof GenericGroup]: GenericGroup[Prop] extends AnyFunction ? Unwrap<Extract<Awaited<ReturnType<GenericGroup[Prop]>>, Right>> : Unwrap<Extract<Awaited<GenericGroup[Prop]>, Right>>;
8
8
  }>> | {
9
- [Prop in keyof GenericGroup]: GenericGroup[Prop] extends AnyFunction ? Extract<Awaited<ReturnType<GenericGroup[Prop]>>, EitherLeft> : Extract<Awaited<GenericGroup[Prop]>, EitherLeft>;
9
+ [Prop in keyof GenericGroup]: GenericGroup[Prop] extends AnyFunction ? Extract<Awaited<ReturnType<GenericGroup[Prop]>>, Left> : Extract<Awaited<GenericGroup[Prop]>, Left>;
10
10
  }[keyof GenericGroup]>;
11
11
  /**
12
12
  * The asyncGroup() function runs synchronous or asynchronous Either values in parallel (promises, Future) and returns the first Left encountered. If all are Right, it aggregates their values into a typed object.
@@ -26,7 +26,7 @@ type ComputeResult<GenericGroup extends Record<string, MayBeGetter<Either>>> = P
26
26
  * profile: promiseProfile,
27
27
  * });
28
28
  *
29
- * // type: E.EitherFutureError
29
+ * // type: E.FutureError
30
30
  * ```
31
31
  *
32
32
  * @remarks