@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,5 +1,9 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
2
 
3
- const eitherBoolKind = createEitherKind("bool");
3
+ const boolKind = createEitherKind("bool");
4
+ /**
5
+ * @deprecated use boolKind
6
+ */
7
+ const eitherBoolKind = boolKind;
4
8
 
5
- export { eitherBoolKind };
9
+ export { boolKind, eitherBoolKind };
@@ -1,8 +1,8 @@
1
1
  import { type FalsyValue, type IsEqual } from "../../common";
2
- import { type EitherBoolFalsy } from "./falsy";
3
- import { type EitherBoolTruthy } from "./truthy";
2
+ import { type BoolFalsy } from "./falsy";
3
+ import { type BoolTruthy } from "./truthy";
4
4
  /**
5
- * Converts any value into a boolean monad (EitherBoolTruthy or EitherBoolFalsy). Handy to keep track of the test while benefiting from the whenIsBoolTruthy/whenIsBoolFalsy helpers.
5
+ * Converts any value into a boolean monad (BoolTruthy or BoolFalsy). Handy to keep track of the test while benefiting from the whenIsBoolTruthy/whenIsBoolFalsy helpers.
6
6
  *
7
7
  * Signature: `bool(value)` → returns a value
8
8
  *
@@ -15,7 +15,7 @@ import { type EitherBoolTruthy } from "./truthy";
15
15
  * E.bool,
16
16
  * );
17
17
  *
18
- * // type: E.EitherBoolFalsy<undefined> | E.EitherBoolTruthy<"nest">
18
+ * // type: E.BoolFalsy<undefined> | E.BoolTruthy<"nest">
19
19
  * ```
20
20
  *
21
21
  * @see https://utils.duplojs.dev/en/v1/api/either/bool
@@ -23,5 +23,5 @@ import { type EitherBoolTruthy } from "./truthy";
23
23
  * @namespace E
24
24
  *
25
25
  */
26
- export declare function bool<const GenericValue extends unknown = undefined>(value: GenericValue): GenericValue extends FalsyValue ? EitherBoolFalsy<GenericValue> : IsEqual<GenericValue, number> extends true ? EitherBoolTruthy<GenericValue> | EitherBoolFalsy<0> : IsEqual<GenericValue, bigint> extends true ? EitherBoolTruthy<GenericValue> | EitherBoolFalsy<0n> : IsEqual<GenericValue, string> extends true ? EitherBoolTruthy<GenericValue> | EitherBoolFalsy<""> : EitherBoolTruthy<GenericValue>;
27
- export type Bool<GenericValue extends unknown> = EitherBoolTruthy<GenericValue> | EitherBoolFalsy;
26
+ export declare function bool<const GenericValue extends unknown = undefined>(value: GenericValue): GenericValue extends FalsyValue ? BoolFalsy<GenericValue> : IsEqual<GenericValue, number> extends true ? BoolTruthy<GenericValue> | BoolFalsy<0> : IsEqual<GenericValue, bigint> extends true ? BoolTruthy<GenericValue> | BoolFalsy<0n> : IsEqual<GenericValue, string> extends true ? BoolTruthy<GenericValue> | BoolFalsy<""> : BoolTruthy<GenericValue>;
27
+ export type Bool<GenericValue extends unknown> = BoolTruthy<GenericValue> | BoolFalsy;
@@ -8,7 +8,11 @@ var is = require('../left/is.cjs');
8
8
  var is$1 = require('../right/is.cjs');
9
9
  var unwrap = require('../../common/unwrap.cjs');
10
10
 
11
- const eitherBoolFalsyKind = kind.createEitherKind("bool-falsy");
11
+ const boolFalsyKind = kind.createEitherKind("bool-falsy");
12
+ /**
13
+ * @deprecated use boolFalsyKind
14
+ */
15
+ const eitherBoolFalsyKind = boolFalsyKind;
12
16
  /**
13
17
  * {@include either/boolFalsy/index.md}
14
18
  */
@@ -19,12 +23,12 @@ const eitherBoolFalsyKind = kind.createEitherKind("bool-falsy");
19
23
  * {@include either/whenIsBoolFalsy/index.md}
20
24
  */
21
25
  function boolFalsy(value = undefined) {
22
- return base.eitherBoolKind.setTo(eitherBoolFalsyKind.setTo(create.left("bool", value)));
26
+ return base.boolKind.setTo(boolFalsyKind.setTo(create.left("bool", value)));
23
27
  }
24
28
  function isBoolFalsy(input) {
25
29
  return is.isLeft(input)
26
- && base.eitherBoolKind.has(input)
27
- && eitherBoolFalsyKind.has(input);
30
+ && base.boolKind.has(input)
31
+ && boolFalsyKind.has(input);
28
32
  }
29
33
  function whenIsBoolFalsy(...args) {
30
34
  if (args.length === 1) {
@@ -48,6 +52,7 @@ function whenIsBoolFalsy(...args) {
48
52
  }
49
53
 
50
54
  exports.boolFalsy = boolFalsy;
55
+ exports.boolFalsyKind = boolFalsyKind;
51
56
  exports.eitherBoolFalsyKind = eitherBoolFalsyKind;
52
57
  exports.isBoolFalsy = isBoolFalsy;
53
58
  exports.whenIsBoolFalsy = whenIsBoolFalsy;
@@ -1,15 +1,23 @@
1
1
  import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink, type FalsyValue } from "../../common";
2
2
  import { type Kind } from "../../common/kind";
3
- import { eitherBoolKind } from "./base";
3
+ import { boolKind } from "./base";
4
4
  import { bool } 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 boolFalsyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/bool-falsy", unknown>>;
8
+ /**
9
+ * @deprecated use boolFalsyKind
10
+ */
7
11
  export declare const eitherBoolFalsyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/bool-falsy", unknown>>;
8
- type _EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> = (EitherLeft<"bool", GenericValue> & Kind<typeof eitherBoolKind.definition> & Kind<typeof eitherBoolFalsyKind.definition>);
9
- export interface EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> extends _EitherBoolFalsy<GenericValue> {
12
+ type _BoolFalsy<GenericValue extends FalsyValue = FalsyValue> = (Left<"bool", GenericValue> & Kind<typeof boolKind.definition> & Kind<typeof boolFalsyKind.definition>);
13
+ export interface BoolFalsy<GenericValue extends FalsyValue = FalsyValue> extends _BoolFalsy<GenericValue> {
10
14
  }
11
15
  /**
12
- * Builds an EitherLeft<"bool"> for an explicitly falsy value (0, "", null, undefined, false).
16
+ * @deprecated use BoolFalsy
17
+ */
18
+ export type EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> = BoolFalsy<GenericValue>;
19
+ /**
20
+ * Builds an Left<"bool"> for an explicitly falsy value (0, "", null, undefined, false).
13
21
  *
14
22
  * Signature: `boolFalsy(value)` → returns a value
15
23
  *
@@ -26,7 +34,7 @@ export interface EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> e
26
34
  * ),
27
35
  * );
28
36
  *
29
- * // type: string | E.EitherBoolFalsy<"">
37
+ * // type: string | E.BoolFalsy<"">
30
38
  * ```
31
39
  *
32
40
  * @see https://utils.duplojs.dev/en/v1/api/either/boolFalsy
@@ -35,7 +43,7 @@ export interface EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> e
35
43
  *
36
44
  */
37
45
  /**
38
- * Type guard that detects an EitherBoolFalsy.
46
+ * Type guard that detects an BoolFalsy.
39
47
  *
40
48
  * Signature: `isBoolFalsy(input)` → returns a value
41
49
  *
@@ -45,7 +53,7 @@ export interface EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> e
45
53
  * const maybeInput = E.bool(true ? true : null);
46
54
  *
47
55
  * if (E.isBoolFalsy(maybeInput)) {
48
- * // type: E.EitherBoolFalsy<null>
56
+ * // type: E.BoolFalsy<null>
49
57
  * }
50
58
  * ```
51
59
  *
@@ -69,7 +77,7 @@ export interface EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> e
69
77
  * E.whenIsBoolFalsy(() => "falsy"),
70
78
  * );
71
79
  *
72
- * // type: E.EitherBoolTruthy<"value"> | "falsy"
80
+ * // type: E.BoolTruthy<"value"> | "falsy"
73
81
  * ```
74
82
  *
75
83
  * @see https://utils.duplojs.dev/en/v1/api/either/whenIsBoolFalsy
@@ -77,10 +85,10 @@ export interface EitherBoolFalsy<GenericValue extends FalsyValue = FalsyValue> e
77
85
  * @namespace E
78
86
  *
79
87
  */
80
- export declare function boolFalsy<const GenericValue extends FalsyValue = undefined>(value?: GenericValue): EitherBoolFalsy<GenericValue>;
81
- type Either = EitherRight | EitherLeft;
82
- export declare function isBoolFalsy<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, EitherBoolFalsy>;
88
+ export declare function boolFalsy<const GenericValue extends FalsyValue = undefined>(value?: GenericValue): BoolFalsy<GenericValue>;
89
+ type Either = Right | Left;
90
+ export declare function isBoolFalsy<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, BoolFalsy>;
83
91
  type ToEither<GenericValue extends unknown> = GenericValue extends Either ? GenericValue : ReturnType<typeof bool<GenericValue>>;
84
- export declare function whenIsBoolFalsy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, EitherBoolFalsy>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToEither<BreakGenericLink<GenericInput>>, EitherBoolFalsy>;
85
- export declare function whenIsBoolFalsy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, EitherBoolFalsy>>) => GenericOutput): GenericOutput | Exclude<ToEither<GenericInput>, EitherBoolFalsy>;
92
+ export declare function whenIsBoolFalsy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, BoolFalsy>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToEither<BreakGenericLink<GenericInput>>, BoolFalsy>;
93
+ export declare function whenIsBoolFalsy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, BoolFalsy>>) => GenericOutput): GenericOutput | Exclude<ToEither<GenericInput>, BoolFalsy>;
86
94
  export {};
@@ -1,12 +1,16 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
- import { eitherBoolKind } from './base.mjs';
2
+ import { boolKind } from './base.mjs';
3
3
  import { bool } 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
  import { unwrap } from '../../common/unwrap.mjs';
8
8
 
9
- const eitherBoolFalsyKind = createEitherKind("bool-falsy");
9
+ const boolFalsyKind = createEitherKind("bool-falsy");
10
+ /**
11
+ * @deprecated use boolFalsyKind
12
+ */
13
+ const eitherBoolFalsyKind = boolFalsyKind;
10
14
  /**
11
15
  * {@include either/boolFalsy/index.md}
12
16
  */
@@ -17,12 +21,12 @@ const eitherBoolFalsyKind = createEitherKind("bool-falsy");
17
21
  * {@include either/whenIsBoolFalsy/index.md}
18
22
  */
19
23
  function boolFalsy(value = undefined) {
20
- return eitherBoolKind.setTo(eitherBoolFalsyKind.setTo(left("bool", value)));
24
+ return boolKind.setTo(boolFalsyKind.setTo(left("bool", value)));
21
25
  }
22
26
  function isBoolFalsy(input) {
23
27
  return isLeft(input)
24
- && eitherBoolKind.has(input)
25
- && eitherBoolFalsyKind.has(input);
28
+ && boolKind.has(input)
29
+ && boolFalsyKind.has(input);
26
30
  }
27
31
  function whenIsBoolFalsy(...args) {
28
32
  if (args.length === 1) {
@@ -45,4 +49,4 @@ function whenIsBoolFalsy(...args) {
45
49
  return either;
46
50
  }
47
51
 
48
- export { boolFalsy, eitherBoolFalsyKind, isBoolFalsy, whenIsBoolFalsy };
52
+ export { boolFalsy, boolFalsyKind, eitherBoolFalsyKind, isBoolFalsy, whenIsBoolFalsy };
@@ -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 eitherBoolTruthyKind = kind.createEitherKind("bool-truthy");
11
+ const boolTruthyKind = kind.createEitherKind("bool-truthy");
12
+ /**
13
+ * @deprecated use boolTruthyKind
14
+ */
15
+ const eitherBoolTruthyKind = boolTruthyKind;
12
16
  /**
13
17
  * {@include either/boolTruthy/index.md}
14
18
  */
@@ -19,12 +23,12 @@ const eitherBoolTruthyKind = kind.createEitherKind("bool-truthy");
19
23
  * {@include either/whenIsBoolTruthy/index.md}
20
24
  */
21
25
  function boolTruthy(value) {
22
- return base.eitherBoolKind.setTo(eitherBoolTruthyKind.setTo(create.right("bool", value)));
26
+ return base.boolKind.setTo(boolTruthyKind.setTo(create.right("bool", value)));
23
27
  }
24
28
  function isBoolTruthy(input) {
25
29
  return is.isRight(input)
26
- && base.eitherBoolKind.has(input)
27
- && eitherBoolTruthyKind.has(input);
30
+ && base.boolKind.has(input)
31
+ && boolTruthyKind.has(input);
28
32
  }
29
33
  function whenIsBoolTruthy(...args) {
30
34
  if (args.length === 1) {
@@ -48,6 +52,7 @@ function whenIsBoolTruthy(...args) {
48
52
  }
49
53
 
50
54
  exports.boolTruthy = boolTruthy;
55
+ exports.boolTruthyKind = boolTruthyKind;
51
56
  exports.eitherBoolTruthyKind = eitherBoolTruthyKind;
52
57
  exports.isBoolTruthy = isBoolTruthy;
53
58
  exports.whenIsBoolTruthy = whenIsBoolTruthy;
@@ -1,15 +1,23 @@
1
1
  import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
2
2
  import { type Kind } from "../../common/kind";
3
- import { eitherBoolKind } from "./base";
4
- import { type EitherLeft } from "../left";
5
- import { type EitherRight } from "../right";
3
+ import { boolKind } from "./base";
4
+ import { type Left } from "../left";
5
+ import { type Right } from "../right";
6
6
  import { bool } from "./create";
7
+ export declare const boolTruthyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/bool-truthy", unknown>>;
8
+ /**
9
+ * @deprecated use boolTruthyKind
10
+ */
7
11
  export declare const eitherBoolTruthyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DuplojsUtilsEither/bool-truthy", unknown>>;
8
- type _EitherBoolTruthy<GenericValue extends unknown = unknown> = (EitherRight<"bool", GenericValue> & Kind<typeof eitherBoolKind.definition> & Kind<typeof eitherBoolTruthyKind.definition>);
9
- export interface EitherBoolTruthy<GenericValue extends unknown = unknown> extends _EitherBoolTruthy<GenericValue> {
12
+ type _BoolTruthy<GenericValue extends unknown = unknown> = (Right<"bool", GenericValue> & Kind<typeof boolKind.definition> & Kind<typeof boolTruthyKind.definition>);
13
+ export interface BoolTruthy<GenericValue extends unknown = unknown> extends _BoolTruthy<GenericValue> {
10
14
  }
11
15
  /**
12
- * Forces the creation of an EitherRight<"bool"> by explicitly marking a truthy value.
16
+ * @deprecated use BoolTruthy
17
+ */
18
+ export type EitherBoolTruthy<GenericValue extends unknown = unknown> = BoolTruthy<GenericValue>;
19
+ /**
20
+ * Forces the creation of an Right<"bool"> by explicitly marking a truthy value.
13
21
  *
14
22
  * Signature: `boolTruthy(value)` → returns a value
15
23
  *
@@ -26,7 +34,7 @@ export interface EitherBoolTruthy<GenericValue extends unknown = unknown> extend
26
34
  * ),
27
35
  * );
28
36
  *
29
- * // type: string | E.EitherBoolTruthy<`${string}@${string}`>
37
+ * // type: string | E.BoolTruthy<`${string}@${string}`>
30
38
  * ```
31
39
  *
32
40
  * @see https://utils.duplojs.dev/en/v1/api/either/boolTruthy
@@ -45,7 +53,7 @@ export interface EitherBoolTruthy<GenericValue extends unknown = unknown> extend
45
53
  * const maybeInput = E.bool(true ? true : null);
46
54
  *
47
55
  * if (E.isBoolTruthy(maybeInput)) {
48
- * // type: E.EitherBoolTruthy<true>
56
+ * // type: E.BoolTruthy<true>
49
57
  * }
50
58
  * ```
51
59
  *
@@ -55,7 +63,7 @@ export interface EitherBoolTruthy<GenericValue extends unknown = unknown> extend
55
63
  *
56
64
  */
57
65
  /**
58
- * Callback executed only for EitherBoolTruthy values. Otherwise, the initial value is returned.
66
+ * Callback executed only for BoolTruthy values. Otherwise, the initial value is returned.
59
67
  *
60
68
  * **Supported call styles:**
61
69
  * - Classic: `whenIsBoolTruthy(input, theFunction)` → returns a value
@@ -69,7 +77,7 @@ export interface EitherBoolTruthy<GenericValue extends unknown = unknown> extend
69
77
  * E.whenIsBoolTruthy(S.toUpperCase),
70
78
  * );
71
79
  *
72
- * // type: E.EitherBoolFalsy<null> | "VALUE"
80
+ * // type: E.BoolFalsy<null> | "VALUE"
73
81
  * ```
74
82
  *
75
83
  * @see https://utils.duplojs.dev/en/v1/api/either/whenIsBoolTruthy
@@ -77,10 +85,10 @@ export interface EitherBoolTruthy<GenericValue extends unknown = unknown> extend
77
85
  * @namespace E
78
86
  *
79
87
  */
80
- export declare function boolTruthy<const GenericValue extends unknown>(value: GenericValue): EitherBoolTruthy<GenericValue>;
81
- type Either = EitherRight | EitherLeft;
82
- export declare function isBoolTruthy<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, EitherBoolTruthy>;
88
+ export declare function boolTruthy<const GenericValue extends unknown>(value: GenericValue): BoolTruthy<GenericValue>;
89
+ type Either = Right | Left;
90
+ export declare function isBoolTruthy<GenericInput extends unknown>(input: GenericInput): input is Extract<GenericInput, BoolTruthy>;
83
91
  type ToEither<GenericValue extends unknown> = GenericValue extends Either ? GenericValue : ReturnType<typeof bool<GenericValue>>;
84
- export declare function whenIsBoolTruthy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, EitherBoolTruthy>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToEither<BreakGenericLink<GenericInput>>, EitherBoolTruthy>;
85
- export declare function whenIsBoolTruthy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, EitherBoolTruthy>>) => GenericOutput): GenericOutput | Exclude<ToEither<GenericInput>, EitherBoolTruthy>;
92
+ export declare function whenIsBoolTruthy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, BoolTruthy>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<ToEither<BreakGenericLink<GenericInput>>, BoolTruthy>;
93
+ export declare function whenIsBoolTruthy<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<ToEither<BreakGenericLink<GenericInput>>, BoolTruthy>>) => GenericOutput): GenericOutput | Exclude<ToEither<GenericInput>, BoolTruthy>;
86
94
  export {};
@@ -1,4 +1,4 @@
1
- import { eitherBoolKind } from './base.mjs';
1
+ import { boolKind } from './base.mjs';
2
2
  import { createEitherKind } from '../kind.mjs';
3
3
  import { bool } from './create.mjs';
4
4
  import { right } from '../right/create.mjs';
@@ -6,7 +6,11 @@ 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 eitherBoolTruthyKind = createEitherKind("bool-truthy");
9
+ const boolTruthyKind = createEitherKind("bool-truthy");
10
+ /**
11
+ * @deprecated use boolTruthyKind
12
+ */
13
+ const eitherBoolTruthyKind = boolTruthyKind;
10
14
  /**
11
15
  * {@include either/boolTruthy/index.md}
12
16
  */
@@ -17,12 +21,12 @@ const eitherBoolTruthyKind = createEitherKind("bool-truthy");
17
21
  * {@include either/whenIsBoolTruthy/index.md}
18
22
  */
19
23
  function boolTruthy(value) {
20
- return eitherBoolKind.setTo(eitherBoolTruthyKind.setTo(right("bool", value)));
24
+ return boolKind.setTo(boolTruthyKind.setTo(right("bool", value)));
21
25
  }
22
26
  function isBoolTruthy(input) {
23
27
  return isRight(input)
24
- && eitherBoolKind.has(input)
25
- && eitherBoolTruthyKind.has(input);
28
+ && boolKind.has(input)
29
+ && boolTruthyKind.has(input);
26
30
  }
27
31
  function whenIsBoolTruthy(...args) {
28
32
  if (args.length === 1) {
@@ -45,4 +49,4 @@ function whenIsBoolTruthy(...args) {
45
49
  return either;
46
50
  }
47
51
 
48
- export { boolTruthy, eitherBoolTruthyKind, isBoolTruthy, whenIsBoolTruthy };
52
+ export { boolTruthy, boolTruthyKind, eitherBoolTruthyKind, isBoolTruthy, whenIsBoolTruthy };
@@ -2,6 +2,11 @@
2
2
 
3
3
  var kind = require('../kind.cjs');
4
4
 
5
- const eitherFutureKind = kind.createEitherKind("future");
5
+ const futureKind = kind.createEitherKind("future");
6
+ /**
7
+ * @deprecated use futureKind
8
+ */
9
+ const eitherFutureKind = futureKind;
6
10
 
7
11
  exports.eitherFutureKind = eitherFutureKind;
12
+ exports.futureKind = futureKind;
@@ -1 +1,5 @@
1
+ export declare const futureKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/future", unknown>>;
2
+ /**
3
+ * @deprecated use futureKind
4
+ */
1
5
  export declare const eitherFutureKind: import("../..").KindHandler<import("../..").KindDefinition<"@DuplojsUtilsEither/future", unknown>>;
@@ -1,5 +1,9 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
2
 
3
- const eitherFutureKind = createEitherKind("future");
3
+ const futureKind = createEitherKind("future");
4
+ /**
5
+ * @deprecated use futureKind
6
+ */
7
+ const eitherFutureKind = futureKind;
4
8
 
5
- export { eitherFutureKind };
9
+ export { eitherFutureKind, futureKind };
@@ -1,12 +1,12 @@
1
- import { type EitherLeft } from "../left";
2
- import { type EitherRight } from "../right";
3
- import { type EitherFutureSuccess } from "./success";
4
- import { type EitherFutureError } from "./error";
1
+ import { type Left } from "../left";
2
+ import { type Right } from "../right";
3
+ import { type FutureSuccess } from "./success";
4
+ import { type FutureError } from "./error";
5
5
  import { type IsEqual } from "../../common/types/isEqual";
6
6
  import { type AnyValue } from "../../common";
7
- type Either = EitherRight | EitherLeft;
8
- type ComputeEitherFutureSuccessResult<GenericValue extends unknown> = IsEqual<never, Exclude<GenericValue, Either>> extends false ? EitherFutureSuccess<Exclude<GenericValue, Either>> : never;
9
- type ComputeEitherFutureErrorResult<GenericValue extends unknown> = GenericValue extends Future<any> ? GenericValue : GenericValue extends Promise<unknown> ? EitherFutureError : never;
7
+ type Either = Right | Left;
8
+ type ComputeEitherFutureSuccessResult<GenericValue extends unknown> = IsEqual<never, Exclude<GenericValue, Either>> extends false ? FutureSuccess<Exclude<GenericValue, Either>> : never;
9
+ type ComputeEitherFutureErrorResult<GenericValue extends unknown> = GenericValue extends Future<any> ? GenericValue : GenericValue extends Promise<unknown> ? FutureError : never;
10
10
  type ComputeFutureEitherResult<GenericValue extends unknown = unknown> = Extract<(Extract<Awaited<GenericValue>, Either> | ComputeEitherFutureSuccessResult<Awaited<GenericValue>> | ComputeEitherFutureErrorResult<GenericValue>), any>;
11
11
  export type FutureEitherAllResult<GenericArray extends readonly unknown[] | []> = Future<{
12
12
  -readonly [Prop in keyof GenericArray]: Awaited<Future<GenericArray[Prop]>>;
@@ -33,7 +33,7 @@ export declare class Future<const GenericValue extends unknown = unknown> extend
33
33
  * );
34
34
  *
35
35
  * await maybePromise.then((value) => {
36
- * // type: E.EitherFutureSuccess<number> | E.EitherFutureError
36
+ * // type: E.FutureSuccess<number> | E.FutureError
37
37
  * return value;
38
38
  * });
39
39
  * ```
@@ -4,13 +4,18 @@ var base = require('./base.cjs');
4
4
  var kind = require('../kind.cjs');
5
5
  var create = require('../left/create.cjs');
6
6
 
7
- const eitherFutureErrorKind = kind.createEitherKind("future-error");
7
+ const futureErrorKind = kind.createEitherKind("future-error");
8
+ /**
9
+ * @deprecated use futureErrorKind
10
+ */
11
+ const eitherFutureErrorKind = futureErrorKind;
8
12
  /**
9
13
  * {@include either/futureError/index.md}
10
14
  */
11
15
  function futureError(value) {
12
- return base.eitherFutureKind.setTo(eitherFutureErrorKind.setTo(create.left("future", value)));
16
+ return base.futureKind.setTo(futureErrorKind.setTo(create.left("future", value)));
13
17
  }
14
18
 
15
19
  exports.eitherFutureErrorKind = eitherFutureErrorKind;
16
20
  exports.futureError = futureError;
21
+ exports.futureErrorKind = futureErrorKind;
@@ -1,12 +1,20 @@
1
1
  import { type Kind } from "../../common/kind";
2
- import { type EitherLeft } from "../left";
3
- import { eitherFutureKind } from "./base";
2
+ import { type Left } from "../left";
3
+ import { futureKind } from "./base";
4
+ export declare const futureErrorKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/future-error", unknown>>;
5
+ /**
6
+ * @deprecated use futureErrorKind
7
+ */
4
8
  export declare const eitherFutureErrorKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/future-error", unknown>>;
5
- type _EitherFutureError = (EitherLeft<"future", unknown> & Kind<typeof eitherFutureKind.definition> & Kind<typeof eitherFutureErrorKind.definition>);
6
- export interface EitherFutureError extends _EitherFutureError {
9
+ type _FutureError = (Left<"future", unknown> & Kind<typeof futureKind.definition> & Kind<typeof futureErrorKind.definition>);
10
+ export interface FutureError extends _FutureError {
7
11
  }
8
12
  /**
9
- * Creates a Future resolved with an EitherLeft<"future">, ideal for propagating a standardized rejection.
13
+ * @deprecated use FutureError
14
+ */
15
+ export type EitherFutureError = FutureError;
16
+ /**
17
+ * Creates a Future resolved with an Left<"future">, ideal for propagating a standardized rejection.
10
18
  *
11
19
  * Signature: `futureError(value)` → returns a value
12
20
  *
@@ -15,7 +23,7 @@ export interface EitherFutureError extends _EitherFutureError {
15
23
  * ```ts
16
24
  * const future = E.futureError("error");
17
25
  *
18
- * // type: E.EitherFutureError
26
+ * // type: E.FutureError
19
27
  * ```
20
28
  *
21
29
  * @see https://utils.duplojs.dev/en/v1/api/either/futureError
@@ -23,5 +31,5 @@ export interface EitherFutureError extends _EitherFutureError {
23
31
  * @namespace E
24
32
  *
25
33
  */
26
- export declare function futureError(value: unknown): EitherFutureError;
34
+ export declare function futureError(value: unknown): FutureError;
27
35
  export {};
@@ -1,13 +1,17 @@
1
- import { eitherFutureKind } from './base.mjs';
1
+ import { futureKind } from './base.mjs';
2
2
  import { createEitherKind } from '../kind.mjs';
3
3
  import { left } from '../left/create.mjs';
4
4
 
5
- const eitherFutureErrorKind = createEitherKind("future-error");
5
+ const futureErrorKind = createEitherKind("future-error");
6
+ /**
7
+ * @deprecated use futureErrorKind
8
+ */
9
+ const eitherFutureErrorKind = futureErrorKind;
6
10
  /**
7
11
  * {@include either/futureError/index.md}
8
12
  */
9
13
  function futureError(value) {
10
- return eitherFutureKind.setTo(eitherFutureErrorKind.setTo(left("future", value)));
14
+ return futureKind.setTo(futureErrorKind.setTo(left("future", value)));
11
15
  }
12
16
 
13
- export { eitherFutureErrorKind, futureError };
17
+ export { eitherFutureErrorKind, futureError, futureErrorKind };
@@ -4,13 +4,18 @@ var kind = require('../kind.cjs');
4
4
  var base = require('./base.cjs');
5
5
  var create = require('../right/create.cjs');
6
6
 
7
- const eitherFutureSuccessKind = kind.createEitherKind("future-success");
7
+ const futureSuccessKind = kind.createEitherKind("future-success");
8
+ /**
9
+ * @deprecated use futureSuccessKind
10
+ */
11
+ const eitherFutureSuccessKind = futureSuccessKind;
8
12
  /**
9
13
  * {@include either/futureSuccess/index.md}
10
14
  */
11
15
  function futureSuccess(value) {
12
- return base.eitherFutureKind.setTo(eitherFutureSuccessKind.setTo(create.right("future", value)));
16
+ return base.futureKind.setTo(futureSuccessKind.setTo(create.right("future", value)));
13
17
  }
14
18
 
15
19
  exports.eitherFutureSuccessKind = eitherFutureSuccessKind;
16
20
  exports.futureSuccess = futureSuccess;
21
+ exports.futureSuccessKind = futureSuccessKind;
@@ -1,12 +1,20 @@
1
1
  import { type Kind } from "../../common/kind";
2
- import { eitherFutureKind } from "./base";
3
- import { type EitherRight } from "../right";
2
+ import { futureKind } from "./base";
3
+ import { type Right } from "../right";
4
+ export declare const futureSuccessKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/future-success", unknown>>;
5
+ /**
6
+ * @deprecated use futureSuccessKind
7
+ */
4
8
  export declare const eitherFutureSuccessKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/future-success", unknown>>;
5
- type _EitherFutureSuccess<GenericValue extends unknown = unknown> = (EitherRight<"future", GenericValue> & Kind<typeof eitherFutureKind.definition> & Kind<typeof eitherFutureSuccessKind.definition>);
6
- export interface EitherFutureSuccess<GenericValue extends unknown = unknown> extends _EitherFutureSuccess<GenericValue> {
9
+ type _FutureSuccess<GenericValue extends unknown = unknown> = (Right<"future", GenericValue> & Kind<typeof futureKind.definition> & Kind<typeof futureSuccessKind.definition>);
10
+ export interface FutureSuccess<GenericValue extends unknown = unknown> extends _FutureSuccess<GenericValue> {
7
11
  }
8
12
  /**
9
- * Creates a Future resolved with an EitherRight<"future">.
13
+ * @deprecated use FutureSuccess
14
+ */
15
+ export type EitherFutureSuccess<GenericValue extends unknown = unknown> = FutureSuccess<GenericValue>;
16
+ /**
17
+ * Creates a Future resolved with an Right<"future">.
10
18
  *
11
19
  * Signature: `futureSuccess(value)` → returns a value
12
20
  *
@@ -15,7 +23,7 @@ export interface EitherFutureSuccess<GenericValue extends unknown = unknown> ext
15
23
  * ```ts
16
24
  * const future = E.futureSuccess("value");
17
25
  *
18
- * // type: E.EitherFutureSuccess<"value">
26
+ * // type: E.FutureSuccess<"value">
19
27
  * ```
20
28
  *
21
29
  * @see https://utils.duplojs.dev/en/v1/api/either/futureSuccess
@@ -23,5 +31,5 @@ export interface EitherFutureSuccess<GenericValue extends unknown = unknown> ext
23
31
  * @namespace E
24
32
  *
25
33
  */
26
- export declare function futureSuccess<const GenericValue extends unknown>(value: GenericValue): EitherFutureSuccess<GenericValue>;
34
+ export declare function futureSuccess<const GenericValue extends unknown>(value: GenericValue): FutureSuccess<GenericValue>;
27
35
  export {};
@@ -1,13 +1,17 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
- import { eitherFutureKind } from './base.mjs';
2
+ import { futureKind } from './base.mjs';
3
3
  import { right } from '../right/create.mjs';
4
4
 
5
- const eitherFutureSuccessKind = createEitherKind("future-success");
5
+ const futureSuccessKind = createEitherKind("future-success");
6
+ /**
7
+ * @deprecated use futureSuccessKind
8
+ */
9
+ const eitherFutureSuccessKind = futureSuccessKind;
6
10
  /**
7
11
  * {@include either/futureSuccess/index.md}
8
12
  */
9
13
  function futureSuccess(value) {
10
- return eitherFutureKind.setTo(eitherFutureSuccessKind.setTo(right("future", value)));
14
+ return futureKind.setTo(futureSuccessKind.setTo(right("future", value)));
11
15
  }
12
16
 
13
- export { eitherFutureSuccessKind, futureSuccess };
17
+ export { eitherFutureSuccessKind, futureSuccess, futureSuccessKind };
@@ -8,8 +8,8 @@ function hasInformation(...args) {
8
8
  return (input) => hasInformation(input, information);
9
9
  }
10
10
  const [input, information] = args;
11
- return kind.eitherInformationKind.has(input)
12
- && kind.eitherInformationKind.getValue(input) === information;
11
+ return kind.informationKind.has(input)
12
+ && kind.informationKind.getValue(input) === information;
13
13
  }
14
14
 
15
15
  exports.hasInformation = hasInformation;