@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,11 +1,19 @@
1
1
  import { type Kind } from "../../common/kind";
2
- import { type EitherRight } from "./create";
2
+ import { type Right } from "./create";
3
+ export declare const successKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/success", unknown>>;
4
+ /**
5
+ * @deprecated use successKind
6
+ */
3
7
  export declare const eitherSuccessKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@DuplojsUtilsEither/success", unknown>>;
4
- type _EitherSuccess<GenericValue extends unknown = unknown> = (EitherRight<"success", GenericValue> & Kind<typeof eitherSuccessKind.definition>);
5
- export interface EitherSuccess<GenericValue extends unknown = unknown> extends _EitherSuccess<GenericValue> {
8
+ type _Success<GenericValue extends unknown = unknown> = (Right<"success", GenericValue> & Kind<typeof successKind.definition>);
9
+ export interface Success<GenericValue extends unknown = unknown> extends _Success<GenericValue> {
6
10
  }
7
11
  /**
8
- * Readable shortcut to create an EitherRight with the literal info "success". Ideal for functions that return only one type of success.
12
+ * @deprecated use Success
13
+ */
14
+ export type EitherSuccess<GenericValue extends unknown = unknown> = Success<GenericValue>;
15
+ /**
16
+ * Readable shortcut to create an Right with the literal info "success". Ideal for functions that return only one type of success.
9
17
  *
10
18
  * Signature: `success(value)` → returns a value
11
19
  *
@@ -24,7 +32,7 @@ export interface EitherSuccess<GenericValue extends unknown = unknown> extends _
24
32
  * ),
25
33
  * );
26
34
  *
27
- * // type: E.EitherError<string> | E.EitherSuccess<string>
35
+ * // type: E.Error<string> | E.Success<string>
28
36
  * ```
29
37
  *
30
38
  * @see https://utils.duplojs.dev/en/v1/api/either/success
@@ -32,5 +40,5 @@ export interface EitherSuccess<GenericValue extends unknown = unknown> extends _
32
40
  * @namespace E
33
41
  *
34
42
  */
35
- export declare function success<const GenericValue extends unknown>(value: GenericValue): EitherSuccess<GenericValue>;
43
+ export declare function success<const GenericValue extends unknown>(value: GenericValue): Success<GenericValue>;
36
44
  export {};
@@ -1,12 +1,16 @@
1
1
  import { createEitherKind } from '../kind.mjs';
2
2
  import { right } from './create.mjs';
3
3
 
4
- const eitherSuccessKind = createEitherKind("success");
4
+ const successKind = createEitherKind("success");
5
+ /**
6
+ * @deprecated use successKind
7
+ */
8
+ const eitherSuccessKind = successKind;
5
9
  /**
6
10
  * {@include either/success/index.md}
7
11
  */
8
12
  function success(value) {
9
- return eitherSuccessKind.setTo(right("success", value));
13
+ return successKind.setTo(right("success", value));
10
14
  }
11
15
 
12
- export { eitherSuccessKind, success };
16
+ export { eitherSuccessKind, success, successKind };
@@ -1,7 +1,7 @@
1
1
  import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
2
- import { type EitherRight } from "./create";
2
+ import { type Right } from "./create";
3
3
  /**
4
- * Applies a function only when the input is an EitherRight. Otherwise, the original value is returned as-is.
4
+ * Applies a function only when the input is an Right. Otherwise, the original value is returned as-is.
5
5
  *
6
6
  * **Supported call styles:**
7
7
  * - Classic: `whenIsRight(input, theFunction)` → returns a value
@@ -26,5 +26,5 @@ import { type EitherRight } from "./create";
26
26
  * @namespace E
27
27
  *
28
28
  */
29
- export declare function whenIsRight<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, EitherRight>>) => GenericOutput): (input: GenericInput) => Exclude<BreakGenericLink<GenericInput>, EitherRight> | GenericOutput;
30
- export declare function whenIsRight<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, EitherRight>>) => GenericOutput): Exclude<GenericInput, EitherRight> | GenericOutput;
29
+ export declare function whenIsRight<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, Right>>) => GenericOutput): (input: GenericInput) => Exclude<BreakGenericLink<GenericInput>, Right> | GenericOutput;
30
+ export declare function whenIsRight<const GenericInput extends unknown, const GenericOutput extends AnyValue | EscapeVoid>(input: GenericInput, theFunction: (eitherValue: Unwrap<Extract<BreakGenericLink<GenericInput>, Right>>) => GenericOutput): Exclude<GenericInput, Right> | GenericOutput;
@@ -6,13 +6,21 @@ var create$1 = require('./right/create.cjs');
6
6
  var is = require('./right/is.cjs');
7
7
  var is$1 = require('./left/is.cjs');
8
8
 
9
- const eitherCallbackErrorKind = kind.createEitherKind("callback-error");
10
- const eitherCallbackSuccessKind = kind.createEitherKind("callback-success");
9
+ const callbackErrorKind = kind.createEitherKind("callback-error");
10
+ /**
11
+ * @deprecated use callbackErrorKind
12
+ */
13
+ const eitherCallbackErrorKind = callbackErrorKind;
14
+ const callbackSuccessKind = kind.createEitherKind("callback-success");
15
+ /**
16
+ * @deprecated use callbackSuccessKind
17
+ */
18
+ const eitherCallbackSuccessKind = callbackSuccessKind;
11
19
  function callbackError(value) {
12
- return eitherCallbackErrorKind.setTo(create.left("callback", value));
20
+ return callbackErrorKind.setTo(create.left("callback", value));
13
21
  }
14
22
  function callbackSuccess(value) {
15
- return eitherCallbackSuccessKind.setTo(create$1.right("callback", value));
23
+ return callbackSuccessKind.setTo(create$1.right("callback", value));
16
24
  }
17
25
  /**
18
26
  * {@include either/safeCallback/index.md}
@@ -31,7 +39,9 @@ function safeCallback(theFunction) {
31
39
  }
32
40
 
33
41
  exports.callbackError = callbackError;
42
+ exports.callbackErrorKind = callbackErrorKind;
34
43
  exports.callbackSuccess = callbackSuccess;
44
+ exports.callbackSuccessKind = callbackSuccessKind;
35
45
  exports.eitherCallbackErrorKind = eitherCallbackErrorKind;
36
46
  exports.eitherCallbackSuccessKind = eitherCallbackSuccessKind;
37
47
  exports.safeCallback = safeCallback;
@@ -1,21 +1,37 @@
1
1
  import type { Kind, EscapeVoid } from "../common";
2
- import { type EitherLeft } from "./left";
3
- import { type EitherRight } from "./right";
2
+ import { type Left } from "./left";
3
+ import { type Right } from "./right";
4
+ export declare const callbackErrorKind: import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsEither/callback-error", unknown>>;
5
+ /**
6
+ * @deprecated use callbackErrorKind
7
+ */
4
8
  export declare const eitherCallbackErrorKind: import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsEither/callback-error", unknown>>;
9
+ export declare const callbackSuccessKind: import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsEither/callback-success", unknown>>;
10
+ /**
11
+ * @deprecated use callbackSuccessKind
12
+ */
5
13
  export declare const eitherCallbackSuccessKind: import("../common").KindHandler<import("../common").KindDefinition<"@DuplojsUtilsEither/callback-success", unknown>>;
6
- type _EitherCallbackError = (EitherLeft<"callback", unknown> & Kind<typeof eitherCallbackErrorKind.definition>);
7
- type _EitherCallbackSuccess<GenericValue extends unknown> = (EitherRight<"callback", GenericValue> & Kind<typeof eitherCallbackSuccessKind.definition>);
8
- export interface EitherCallbackError extends _EitherCallbackError {
14
+ type _CallbackError = (Left<"callback", unknown> & Kind<typeof callbackErrorKind.definition>);
15
+ type _CallbackSuccess<GenericValue extends unknown> = (Right<"callback", GenericValue> & Kind<typeof callbackSuccessKind.definition>);
16
+ export interface CallbackError extends _CallbackError {
9
17
  }
10
- export interface EitherCallbackSuccess<GenericValue extends unknown> extends _EitherCallbackSuccess<GenericValue> {
18
+ export interface CallbackSuccess<GenericValue extends unknown> extends _CallbackSuccess<GenericValue> {
11
19
  }
12
- export declare function callbackError(value: unknown): EitherCallbackError;
13
- export declare function callbackSuccess<GenericValue extends unknown>(value: GenericValue): EitherCallbackSuccess<GenericValue>;
14
- type Either = EitherRight | EitherLeft;
15
- type ComputeSafeCallbackResult<GenericOutput extends unknown> = GenericOutput extends Either ? GenericOutput : GenericOutput extends EscapeVoid ? EitherCallbackSuccess<undefined> : EitherCallbackSuccess<GenericOutput>;
16
20
  /**
17
- * Runs a callback in a safe block. If the callback throws, the function returns a "callback" typed EitherLeft instead of propagating the exception.
18
- * If the callback returns an Either, it is returned as-is; otherwise the value is wrapped in an EitherRight.
21
+ * @deprecated use CallbackError
22
+ */
23
+ export type EitherCallbackError = CallbackError;
24
+ /**
25
+ * @deprecated use CallbackSuccess
26
+ */
27
+ export type EitherCallbackSuccess<GenericValue extends unknown> = CallbackSuccess<GenericValue>;
28
+ export declare function callbackError(value: unknown): CallbackError;
29
+ export declare function callbackSuccess<GenericValue extends unknown>(value: GenericValue): CallbackSuccess<GenericValue>;
30
+ type Either = Right | Left;
31
+ type ComputeSafeCallbackResult<GenericOutput extends unknown> = GenericOutput extends Either ? GenericOutput : GenericOutput extends EscapeVoid ? CallbackSuccess<undefined> : CallbackSuccess<GenericOutput>;
32
+ /**
33
+ * Runs a callback in a safe block. If the callback throws, the function returns a "callback" typed Left instead of propagating the exception.
34
+ * If the callback returns an Either, it is returned as-is; otherwise the value is wrapped in an Right.
19
35
  *
20
36
  * Signature: `safeCallback(theFunction)` → returns a value
21
37
  *
@@ -23,7 +39,7 @@ type ComputeSafeCallbackResult<GenericOutput extends unknown> = GenericOutput ex
23
39
  *
24
40
  * ```ts
25
41
  * const success = E.safeCallback(() => 42);
26
- * // E.EitherCallbackError | E.EitherCallbackSuccess<number>
42
+ * // E.CallbackError | E.CallbackSuccess<number>
27
43
  *
28
44
  * const failure = E.safeCallback(() => {
29
45
  * throw new Error("boom");
@@ -35,12 +51,12 @@ type ComputeSafeCallbackResult<GenericOutput extends unknown> = GenericOutput ex
35
51
  * () => E.left("example", "already"),
36
52
  * );
37
53
  *
38
- * const isEitherLeft = E.isLeft(eitherResult);
54
+ * const isLeft = E.isLeft(eitherResult);
39
55
  * ```
40
56
  *
41
57
  * @remarks
42
- * - Catches exceptions thrown by the callback and wraps them in an `EitherLeft<"callback">`
43
- * - Keeps an `EitherLeft` or `EitherRight` returned by the callback untouched
58
+ * - Catches exceptions thrown by the callback and wraps them in an `Left<"callback">`
59
+ * - Keeps an `Left` or `Right` returned by the callback untouched
44
60
  * - Useful for working in an unsafe environment (3rd party libraries, user code, etc.)
45
61
  *
46
62
  * @see https://utils.duplojs.dev/en/v1/api/either/safeCallback
@@ -48,5 +64,5 @@ type ComputeSafeCallbackResult<GenericOutput extends unknown> = GenericOutput ex
48
64
  * @namespace E
49
65
  *
50
66
  */
51
- export declare function safeCallback<GenericOutput extends unknown>(theFunction: () => GenericOutput): ComputeSafeCallbackResult<GenericOutput> | EitherCallbackError;
67
+ export declare function safeCallback<GenericOutput extends unknown>(theFunction: () => GenericOutput): ComputeSafeCallbackResult<GenericOutput> | CallbackError;
52
68
  export {};
@@ -4,13 +4,21 @@ import { right } from './right/create.mjs';
4
4
  import { isRight } from './right/is.mjs';
5
5
  import { isLeft } from './left/is.mjs';
6
6
 
7
- const eitherCallbackErrorKind = createEitherKind("callback-error");
8
- const eitherCallbackSuccessKind = createEitherKind("callback-success");
7
+ const callbackErrorKind = createEitherKind("callback-error");
8
+ /**
9
+ * @deprecated use callbackErrorKind
10
+ */
11
+ const eitherCallbackErrorKind = callbackErrorKind;
12
+ const callbackSuccessKind = createEitherKind("callback-success");
13
+ /**
14
+ * @deprecated use callbackSuccessKind
15
+ */
16
+ const eitherCallbackSuccessKind = callbackSuccessKind;
9
17
  function callbackError(value) {
10
- return eitherCallbackErrorKind.setTo(left("callback", value));
18
+ return callbackErrorKind.setTo(left("callback", value));
11
19
  }
12
20
  function callbackSuccess(value) {
13
- return eitherCallbackSuccessKind.setTo(right("callback", value));
21
+ return callbackSuccessKind.setTo(right("callback", value));
14
22
  }
15
23
  /**
16
24
  * {@include either/safeCallback/index.md}
@@ -28,4 +36,4 @@ function safeCallback(theFunction) {
28
36
  }
29
37
  }
30
38
 
31
- export { callbackError, callbackSuccess, eitherCallbackErrorKind, eitherCallbackSuccessKind, safeCallback };
39
+ export { callbackError, callbackErrorKind, callbackSuccess, callbackSuccessKind, eitherCallbackErrorKind, eitherCallbackSuccessKind, safeCallback };
@@ -15,7 +15,7 @@ function whenHasInformation(...args) {
15
15
  ? information
16
16
  : [information];
17
17
  if ((is.isLeft(input)
18
- || is$1.isRight(input)) && formattedInformation.includes(kind.eitherInformationKind.getValue(input))) {
18
+ || is$1.isRight(input)) && formattedInformation.includes(kind.informationKind.getValue(input))) {
19
19
  return theFunction(unwrap.unwrap(input));
20
20
  }
21
21
  return input;
@@ -1,8 +1,8 @@
1
1
  import { type Kind, type WrappedValue, type AnyValue, type Unwrap, type BreakGenericLink } from "../common";
2
- import { type EitherRight } from "./right";
3
- import { type EitherLeft } from "./left";
4
- import { eitherInformationKind } from "./kind";
5
- type Either = EitherRight | EitherLeft;
2
+ import { type Right } from "./right";
3
+ import { type Left } from "./left";
4
+ import { informationKind } from "./kind";
5
+ type Either = Right | Left;
6
6
  /**
7
7
  * Functional pattern matching based on the literal information of an Either. The function is executed only when the information (or one of the informations) matches.
8
8
  *
@@ -31,7 +31,7 @@ type Either = EitherRight | EitherLeft;
31
31
  * }),
32
32
  * );
33
33
  *
34
- * // type: 1 | 2 | E.EitherLeft<"left-3", 3>
34
+ * // type: 1 | 2 | E.Left<"left-3", 3>
35
35
  * ```
36
36
  *
37
37
  * @see https://utils.duplojs.dev/en/v1/api/either/whenHasInformation
@@ -39,6 +39,6 @@ type Either = EitherRight | EitherLeft;
39
39
  * @namespace E
40
40
  *
41
41
  */
42
- export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<BreakGenericLink<GenericInput>, Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<BreakGenericLink<GenericInput>, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
43
- export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(input: GenericInput, information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<BreakGenericLink<GenericInput>, Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): GenericOutput | Exclude<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
42
+ export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof informationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<BreakGenericLink<GenericInput>, Kind<typeof informationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): (input: GenericInput) => GenericOutput | Exclude<BreakGenericLink<GenericInput>, Kind<typeof informationKind.definition, GenericInformation>>;
43
+ export declare function whenHasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof informationKind.getValue<GenericInput>> : never), const GenericOutput extends AnyValue>(input: GenericInput, information: GenericInformation | GenericInformation[], theFunction: (value: Unwrap<Extract<BreakGenericLink<GenericInput>, Kind<typeof informationKind.definition, GenericInformation> & WrappedValue>>) => GenericOutput): GenericOutput | Exclude<GenericInput, Kind<typeof informationKind.definition, GenericInformation>>;
44
44
  export {};
@@ -1,4 +1,4 @@
1
- import { eitherInformationKind } from './kind.mjs';
1
+ import { informationKind } from './kind.mjs';
2
2
  import { isLeft } from './left/is.mjs';
3
3
  import { isRight } from './right/is.mjs';
4
4
  import { unwrap } from '../common/unwrap.mjs';
@@ -13,7 +13,7 @@ function whenHasInformation(...args) {
13
13
  ? information
14
14
  : [information];
15
15
  if ((isLeft(input)
16
- || isRight(input)) && formattedInformation.includes(eitherInformationKind.getValue(input))) {
16
+ || isRight(input)) && formattedInformation.includes(informationKind.getValue(input))) {
17
17
  return theFunction(unwrap(input));
18
18
  }
19
19
  return input;
@@ -43,5 +43,5 @@
43
43
  * @namespace S
44
44
  *
45
45
  */
46
- export declare function isIn<GenericInput extends string, GenericValue extends GenericInput>(array: readonly GenericValue[]): (input: GenericInput) => input is Extract<GenericInput, GenericValue>;
47
- export declare function isIn<GenericInput extends string, GenericValue extends GenericInput>(input: GenericInput, array: readonly GenericValue[]): input is Extract<GenericInput, GenericValue>;
46
+ export declare function isIn<GenericValue extends string>(array: readonly (GenericValue | string)[]): (input: string) => input is GenericValue;
47
+ export declare function isIn<GenericValue extends string>(input: string, array: readonly (GenericValue | string)[]): input is GenericValue;
@@ -10,7 +10,7 @@
10
10
  * ```ts
11
11
  * S.slice("DuploJS Utils", 0, 7); // "DuploJS"
12
12
  *
13
- * S.slice("DuploJS Utils", -5); // "Utils"
13
+ * S.slice("DuploJS Utils", -5, Infinity); // "Utils"
14
14
  *
15
15
  * pipe(
16
16
  * "DuploJS Utils",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duplojs/utils",
3
- "version": "1.4.44",
3
+ "version": "1.4.46",
4
4
  "author": {
5
5
  "name": "mathcovax",
6
6
  "url": "https://github.com/mathcovax"