@duplojs/utils 1.4.44 → 1.4.45

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 (113) 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/parsers/empty.d.ts +1 -1
  17. package/dist/date/create.d.ts +1 -1
  18. package/dist/date/createTime.d.ts +1 -1
  19. package/dist/either/bool/base.cjs +6 -1
  20. package/dist/either/bool/base.d.ts +4 -0
  21. package/dist/either/bool/base.mjs +6 -2
  22. package/dist/either/bool/create.d.ts +6 -6
  23. package/dist/either/bool/falsy.cjs +9 -4
  24. package/dist/either/bool/falsy.d.ts +23 -15
  25. package/dist/either/bool/falsy.mjs +10 -6
  26. package/dist/either/bool/truthy.cjs +9 -4
  27. package/dist/either/bool/truthy.d.ts +23 -15
  28. package/dist/either/bool/truthy.mjs +10 -6
  29. package/dist/either/future/base.cjs +6 -1
  30. package/dist/either/future/base.d.ts +4 -0
  31. package/dist/either/future/base.mjs +6 -2
  32. package/dist/either/future/create.d.ts +8 -8
  33. package/dist/either/future/error.cjs +7 -2
  34. package/dist/either/future/error.d.ts +15 -7
  35. package/dist/either/future/error.mjs +8 -4
  36. package/dist/either/future/success.cjs +7 -2
  37. package/dist/either/future/success.d.ts +15 -7
  38. package/dist/either/future/success.mjs +8 -4
  39. package/dist/either/hasInformation.cjs +2 -2
  40. package/dist/either/hasInformation.d.ts +8 -8
  41. package/dist/either/hasInformation.mjs +3 -3
  42. package/dist/either/index.cjs +24 -0
  43. package/dist/either/index.mjs +23 -23
  44. package/dist/either/kind.cjs +6 -1
  45. package/dist/either/kind.d.ts +4 -0
  46. package/dist/either/kind.mjs +6 -2
  47. package/dist/either/left/create.cjs +7 -2
  48. package/dist/either/left/create.d.ts +14 -6
  49. package/dist/either/left/create.mjs +8 -4
  50. package/dist/either/left/error.cjs +7 -2
  51. package/dist/either/left/error.d.ts +14 -6
  52. package/dist/either/left/error.mjs +7 -3
  53. package/dist/either/left/fail.cjs +7 -2
  54. package/dist/either/left/fail.d.ts +14 -6
  55. package/dist/either/left/fail.mjs +7 -3
  56. package/dist/either/left/is.cjs +2 -2
  57. package/dist/either/left/is.d.ts +4 -4
  58. package/dist/either/left/is.mjs +4 -4
  59. package/dist/either/left/when.d.ts +4 -4
  60. package/dist/either/nullable/base.cjs +6 -1
  61. package/dist/either/nullable/base.d.ts +4 -0
  62. package/dist/either/nullable/base.mjs +6 -2
  63. package/dist/either/nullable/create.d.ts +5 -5
  64. package/dist/either/nullable/empty.cjs +9 -4
  65. package/dist/either/nullable/empty.d.ts +23 -15
  66. package/dist/either/nullable/empty.mjs +10 -6
  67. package/dist/either/nullable/filled.cjs +9 -4
  68. package/dist/either/nullable/filled.d.ts +22 -14
  69. package/dist/either/nullable/filled.mjs +10 -6
  70. package/dist/either/nullish/base.cjs +6 -1
  71. package/dist/either/nullish/base.d.ts +4 -0
  72. package/dist/either/nullish/base.mjs +6 -2
  73. package/dist/either/nullish/create.d.ts +5 -5
  74. package/dist/either/nullish/empty.cjs +9 -4
  75. package/dist/either/nullish/empty.d.ts +23 -15
  76. package/dist/either/nullish/empty.mjs +10 -6
  77. package/dist/either/nullish/filled.cjs +9 -4
  78. package/dist/either/nullish/filled.d.ts +23 -15
  79. package/dist/either/nullish/filled.mjs +10 -6
  80. package/dist/either/optional/base.cjs +6 -1
  81. package/dist/either/optional/base.d.ts +4 -0
  82. package/dist/either/optional/base.mjs +6 -2
  83. package/dist/either/optional/create.d.ts +5 -5
  84. package/dist/either/optional/empty.cjs +9 -4
  85. package/dist/either/optional/empty.d.ts +23 -15
  86. package/dist/either/optional/empty.mjs +10 -6
  87. package/dist/either/optional/filled.cjs +9 -4
  88. package/dist/either/optional/filled.d.ts +22 -14
  89. package/dist/either/optional/filled.mjs +10 -6
  90. package/dist/either/right/asyncGroup.d.ts +7 -7
  91. package/dist/either/right/asyncPipe.d.ts +33 -25
  92. package/dist/either/right/create.cjs +7 -2
  93. package/dist/either/right/create.d.ts +15 -7
  94. package/dist/either/right/create.mjs +8 -4
  95. package/dist/either/right/group.d.ts +8 -8
  96. package/dist/either/right/is.cjs +2 -2
  97. package/dist/either/right/is.d.ts +4 -4
  98. package/dist/either/right/is.mjs +4 -4
  99. package/dist/either/right/ok.cjs +7 -2
  100. package/dist/either/right/ok.d.ts +14 -6
  101. package/dist/either/right/ok.mjs +7 -3
  102. package/dist/either/right/pipe.d.ts +32 -24
  103. package/dist/either/right/success.cjs +7 -2
  104. package/dist/either/right/success.d.ts +14 -6
  105. package/dist/either/right/success.mjs +7 -3
  106. package/dist/either/right/when.d.ts +4 -4
  107. package/dist/either/safeCallback.cjs +14 -4
  108. package/dist/either/safeCallback.d.ts +33 -17
  109. package/dist/either/safeCallback.mjs +13 -5
  110. package/dist/either/whenHasInformation.cjs +1 -1
  111. package/dist/either/whenHasInformation.d.ts +7 -7
  112. package/dist/either/whenHasInformation.mjs +2 -2
  113. package/package.json +1 -1
@@ -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;
@@ -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';