@clipboard-health/util-ts 2.8.8 → 2.9.1
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.
- package/README.md +219 -2
- package/package.json +13 -5
- package/src/index.d.ts +20 -15
- package/src/index.js +21 -14
- package/src/index.js.map +1 -1
- package/src/lib/{head.d.ts → arrays/head.d.ts} +6 -2
- package/src/lib/{head.js → arrays/head.js} +4 -1
- package/src/lib/arrays/head.js.map +1 -0
- package/src/lib/{non-empty-array.d.ts → arrays/nonEmptyArray.d.ts} +0 -1
- package/src/lib/{non-empty-array.js → arrays/nonEmptyArray.js} +1 -1
- package/src/lib/arrays/nonEmptyArray.js.map +1 -0
- package/src/lib/deepFreeze.d.ts +9 -0
- package/src/lib/deepFreeze.js +27 -0
- package/src/lib/deepFreeze.js.map +1 -0
- package/src/lib/errors/cbhError.d.ts +33 -0
- package/src/lib/{cbh-error.js → errors/cbhError.js} +10 -3
- package/src/lib/errors/cbhError.js.map +1 -0
- package/src/lib/errors/isError.d.ts +7 -0
- package/src/lib/errors/isError.js +13 -0
- package/src/lib/errors/isError.js.map +1 -0
- package/src/lib/errors/serviceError.d.ts +86 -0
- package/src/lib/errors/serviceError.js +180 -0
- package/src/lib/errors/serviceError.js.map +1 -0
- package/src/lib/errors/toError.d.ts +8 -0
- package/src/lib/errors/toError.js +35 -0
- package/src/lib/errors/toError.js.map +1 -0
- package/src/lib/errors/toErrorMessage.d.ts +7 -0
- package/src/lib/errors/toErrorMessage.js +14 -0
- package/src/lib/errors/toErrorMessage.js.map +1 -0
- package/src/lib/{force-cast.d.ts → forceCast.d.ts} +2 -1
- package/src/lib/{force-cast.js → forceCast.js} +3 -1
- package/src/lib/forceCast.js.map +1 -0
- package/src/lib/functional/cbhResponse.d.ts +23 -0
- package/src/lib/{cbh-response.js → functional/cbhResponse.js} +9 -3
- package/src/lib/functional/cbhResponse.js.map +1 -0
- package/src/lib/functional/either.d.ts +86 -0
- package/src/lib/functional/either.js +97 -0
- package/src/lib/functional/either.js.map +1 -0
- package/src/lib/functional/option.d.ts +71 -0
- package/src/lib/functional/option.js +82 -0
- package/src/lib/functional/option.js.map +1 -0
- package/src/lib/functional/pipe.d.ts +21 -0
- package/src/lib/functional/pipe.js +7 -0
- package/src/lib/functional/pipe.js.map +1 -0
- package/src/lib/functional/serviceResult.d.ts +23 -0
- package/src/lib/functional/serviceResult.js +27 -0
- package/src/lib/functional/serviceResult.js.map +1 -0
- package/src/lib/nullish/isDefined.d.ts +9 -0
- package/src/lib/nullish/isDefined.js +15 -0
- package/src/lib/nullish/isDefined.js.map +1 -0
- package/src/lib/nullish/isNil.d.ts +12 -0
- package/src/lib/nullish/isNil.js +20 -0
- package/src/lib/nullish/isNil.js.map +1 -0
- package/src/lib/{null-to-undefined.d.ts → nullish/nullToUndefined.d.ts} +0 -1
- package/src/lib/{null-to-undefined.js → nullish/nullToUndefined.js} +1 -1
- package/src/lib/nullish/nullToUndefined.js.map +1 -0
- package/src/lib/strings/isString.d.ts +7 -0
- package/src/lib/strings/isString.js +13 -0
- package/src/lib/strings/isString.js.map +1 -0
- package/src/lib/strings/stringify.d.ts +8 -0
- package/src/lib/strings/stringify.js +14 -0
- package/src/lib/strings/stringify.js.map +1 -0
- package/src/lib/types.d.ts +1 -0
- package/src/lib/types.js +3 -0
- package/src/lib/types.js.map +1 -0
- package/src/index.d.ts.map +0 -1
- package/src/lib/cbh-error.d.ts +0 -22
- package/src/lib/cbh-error.d.ts.map +0 -1
- package/src/lib/cbh-error.js.map +0 -1
- package/src/lib/cbh-response.d.ts +0 -18
- package/src/lib/cbh-response.d.ts.map +0 -1
- package/src/lib/cbh-response.js.map +0 -1
- package/src/lib/defined-utils.d.ts +0 -11
- package/src/lib/defined-utils.d.ts.map +0 -1
- package/src/lib/defined-utils.js +0 -17
- package/src/lib/defined-utils.js.map +0 -1
- package/src/lib/delay.d.ts +0 -5
- package/src/lib/delay.d.ts.map +0 -1
- package/src/lib/delay.js +0 -12
- package/src/lib/delay.js.map +0 -1
- package/src/lib/either.d.ts +0 -32
- package/src/lib/either.d.ts.map +0 -1
- package/src/lib/either.js +0 -31
- package/src/lib/either.js.map +0 -1
- package/src/lib/force-cast.d.ts.map +0 -1
- package/src/lib/force-cast.js.map +0 -1
- package/src/lib/head.d.ts.map +0 -1
- package/src/lib/head.js.map +0 -1
- package/src/lib/identity.d.ts +0 -7
- package/src/lib/identity.d.ts.map +0 -1
- package/src/lib/identity.js +0 -12
- package/src/lib/identity.js.map +0 -1
- package/src/lib/is-string.d.ts +0 -2
- package/src/lib/is-string.d.ts.map +0 -1
- package/src/lib/is-string.js +0 -7
- package/src/lib/is-string.js.map +0 -1
- package/src/lib/non-empty-array.d.ts.map +0 -1
- package/src/lib/non-empty-array.js.map +0 -1
- package/src/lib/null-to-undefined.d.ts.map +0 -1
- package/src/lib/null-to-undefined.js.map +0 -1
- package/src/lib/option.d.ts +0 -28
- package/src/lib/option.d.ts.map +0 -1
- package/src/lib/option.js +0 -29
- package/src/lib/option.js.map +0 -1
- package/src/lib/stringify.d.ts +0 -5
- package/src/lib/stringify.d.ts.map +0 -1
- package/src/lib/stringify.js +0 -10
- package/src/lib/stringify.js.map +0 -1
- package/src/lib/to-error.d.ts +0 -13
- package/src/lib/to-error.d.ts.map +0 -1
- package/src/lib/to-error.js +0 -34
- package/src/lib/to-error.js.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.none = void 0;
|
|
4
|
+
exports.some = some;
|
|
5
|
+
exports.isNone = isNone;
|
|
6
|
+
exports.isSome = isSome;
|
|
7
|
+
exports.map = map;
|
|
8
|
+
exports.flatMap = flatMap;
|
|
9
|
+
exports.getOrElse = getOrElse;
|
|
10
|
+
exports.match = match;
|
|
11
|
+
/**
|
|
12
|
+
* Constructs an `Option` of `None`, representing a missing value.
|
|
13
|
+
*/
|
|
14
|
+
exports.none = { isSome: false };
|
|
15
|
+
/**
|
|
16
|
+
* Constructs an `Option` holding a `Some<A>`, representing an optional value that exists.
|
|
17
|
+
*
|
|
18
|
+
* @param value - The value to wrap in a `Some`
|
|
19
|
+
* @returns A `Some` containing the value
|
|
20
|
+
*/
|
|
21
|
+
function some(value) {
|
|
22
|
+
return { isSome: true, value };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Type guard that checks if an `Option` is `None`.
|
|
26
|
+
*
|
|
27
|
+
* @param option - The `Option` to check
|
|
28
|
+
* @returns `true` if the `Option` is `None`, `false` if it is `Some<A>`
|
|
29
|
+
*/
|
|
30
|
+
function isNone(option) {
|
|
31
|
+
return !option.isSome;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Type guard that checks if an `Option` is `Some<A>`.
|
|
35
|
+
*
|
|
36
|
+
* @param option - The `Option` to check
|
|
37
|
+
* @returns `true` if the `Option` is `Some<A>`, `false` if it is `None`
|
|
38
|
+
*/
|
|
39
|
+
function isSome(option) {
|
|
40
|
+
return option.isSome;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Transforms the value inside an `Option` using the provided function. If the `Option` is
|
|
44
|
+
* `Some(value)`, returns `Some(f(value))`. If the `Option` is `None`, returns `None`.
|
|
45
|
+
*
|
|
46
|
+
* @param f - The function to apply to the value if it exists
|
|
47
|
+
* @returns A new `Option` containing the transformed value
|
|
48
|
+
*/
|
|
49
|
+
function map(f) {
|
|
50
|
+
return (option) => (isSome(option) ? some(f(option.value)) : exports.none);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Chains `Option` operations that return `Option`s. Unlike `map` which wraps the result in a new
|
|
54
|
+
* `Option`, `flatMap` prevents nested `Option`s like `Some(Some(value))`.
|
|
55
|
+
*
|
|
56
|
+
* @param f - A function that returns an `Option`
|
|
57
|
+
* @returns The `Option` returned by the function if the input is `Some`, `None` otherwise
|
|
58
|
+
*/
|
|
59
|
+
function flatMap(f) {
|
|
60
|
+
return (option) => (isSome(option) ? f(option.value) : exports.none);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Safely extracts the value from an `Option` with a fallback. Use this function when you need to
|
|
64
|
+
* convert an `Option<A>` to an `A`, providing a default value for the `None` case.
|
|
65
|
+
*
|
|
66
|
+
* @param defaultValue - The value to return if the `Option` is `None`
|
|
67
|
+
* @returns The contained value if `Some`, `defaultValue` if `None`
|
|
68
|
+
*/
|
|
69
|
+
function getOrElse(defaultValue) {
|
|
70
|
+
return (option) => (isSome(option) ? option.value : defaultValue);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Pattern matches on an `Option`, handling both `Some` and `None` cases.
|
|
74
|
+
*
|
|
75
|
+
* @param onNone - Function to handle the `None` case
|
|
76
|
+
* @param onSome - Function to handle the `Some` case
|
|
77
|
+
* @returns The result of either `onNone` or `onSome` based on the `Option` state
|
|
78
|
+
*/
|
|
79
|
+
function match(onNone, onSome) {
|
|
80
|
+
return (option) => (isSome(option) ? onSome(option.value) : onNone());
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=option.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/functional/option.ts"],"names":[],"mappings":";;;AA4BA,oBAEC;AAQD,wBAEC;AAQD,wBAEC;AASD,kBAEC;AASD,0BAEC;AASD,8BAEC;AASD,sBAEC;AA7ED;;GAEG;AACU,QAAA,IAAI,GAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAE5C;;;;;GAKG;AACH,SAAgB,IAAI,CAAI,KAAQ;IAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,MAAM,CAAI,MAAiB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,MAAM,CAAI,MAAiB;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,GAAG,CAAO,CAAc;IACtC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,YAAI,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAAO,CAAsB;IAClD,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAI,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CAAI,YAAe;IAC1C,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,KAAK,CAAO,MAAe,EAAE,MAAuB;IAClE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipes a value through a series of functions from left to right. Currently supports up to 10
|
|
3
|
+
* functions.
|
|
4
|
+
*
|
|
5
|
+
* @includeExample ./packages/util-ts/examples/pipe.ts
|
|
6
|
+
* @see [Usage example](../../util-ts/examples/pipe.ts)
|
|
7
|
+
*
|
|
8
|
+
* @param a - The initial value to transform
|
|
9
|
+
* @param fs - Functions to apply sequentially
|
|
10
|
+
* @returns The final transformed value
|
|
11
|
+
*/
|
|
12
|
+
export declare function pipe<A>(a: A): A;
|
|
13
|
+
export declare function pipe<A, B>(a: A, ab: (a: A) => B): B;
|
|
14
|
+
export declare function pipe<A, B, C>(a: A, ab: (a: A) => B, bc: (b: B) => C): C;
|
|
15
|
+
export declare function pipe<A, B, C, D>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D;
|
|
16
|
+
export declare function pipe<A, B, C, D, E>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): E;
|
|
17
|
+
export declare function pipe<A, B, C, D, E, F>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (ef: E) => F): F;
|
|
18
|
+
export declare function pipe<A, B, C, D, E, F, G>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (ef: E) => F, fg: (f: F) => G): G;
|
|
19
|
+
export declare function pipe<A, B, C, D, E, F, G, H>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (ef: E) => F, fg: (f: F) => G, gh: (g: G) => H): H;
|
|
20
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (ef: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): I;
|
|
21
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (ef: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (ij: I) => J): J;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/functional/pipe.ts"],"names":[],"mappings":";;AAwEA,oBAEC;AAFD,SAAgB,IAAI,CAAC,CAAU,EAAE,GAAG,EAAkC;IACpE,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { either as E } from "@clipboard-health/util-ts";
|
|
2
|
+
import { ServiceError, type ServiceErrorParams } from "../errors/serviceError";
|
|
3
|
+
/**
|
|
4
|
+
* Represents the result of a service operation that may fail.
|
|
5
|
+
* @template A The type of the successful result value
|
|
6
|
+
*/
|
|
7
|
+
export type ServiceResult<A> = E.Either<ServiceError, A>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a successful `ServiceResult` containing the provided value.
|
|
10
|
+
*
|
|
11
|
+
* @template A The type of the success value
|
|
12
|
+
* @param value The value to wrap in a successful result
|
|
13
|
+
* @returns A `ServiceResult` containing the success value
|
|
14
|
+
*/
|
|
15
|
+
export declare function success<A>(value: A): ServiceResult<A>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a failed `ServiceResult` containing a `ServiceError`.
|
|
18
|
+
*
|
|
19
|
+
* @template A The type of the success value
|
|
20
|
+
* @param params The parameters to create the `ServiceError`
|
|
21
|
+
* @returns A `ServiceResult` containing the error
|
|
22
|
+
*/
|
|
23
|
+
export declare function failure<A = never>(params: ServiceErrorParams | ServiceError): ServiceResult<A>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.success = success;
|
|
4
|
+
exports.failure = failure;
|
|
5
|
+
const util_ts_1 = require("@clipboard-health/util-ts");
|
|
6
|
+
const serviceError_1 = require("../errors/serviceError");
|
|
7
|
+
/**
|
|
8
|
+
* Creates a successful `ServiceResult` containing the provided value.
|
|
9
|
+
*
|
|
10
|
+
* @template A The type of the success value
|
|
11
|
+
* @param value The value to wrap in a successful result
|
|
12
|
+
* @returns A `ServiceResult` containing the success value
|
|
13
|
+
*/
|
|
14
|
+
function success(value) {
|
|
15
|
+
return util_ts_1.either.right(value);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a failed `ServiceResult` containing a `ServiceError`.
|
|
19
|
+
*
|
|
20
|
+
* @template A The type of the success value
|
|
21
|
+
* @param params The parameters to create the `ServiceError`
|
|
22
|
+
* @returns A `ServiceResult` containing the error
|
|
23
|
+
*/
|
|
24
|
+
function failure(params) {
|
|
25
|
+
return util_ts_1.either.left(params instanceof serviceError_1.ServiceError ? params : new serviceError_1.ServiceError(params));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=serviceResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceResult.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/functional/serviceResult.ts"],"names":[],"mappings":";;AAiBA,0BAEC;AASD,0BAEC;AA9BD,uDAAwD;AAExD,yDAA+E;AAQ/E;;;;;;GAMG;AACH,SAAgB,OAAO,CAAI,KAAQ;IACjC,OAAO,gBAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAAY,MAAyC;IAC1E,OAAO,gBAAC,CAAC,IAAI,CAAC,MAAM,YAAY,2BAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type NullOrUndefined } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard that checks if a value is defined (not null or undefined).
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the value when it is defined
|
|
6
|
+
* @param value - The value to check
|
|
7
|
+
* @returns True if the value is defined (not null or undefined), false otherwise
|
|
8
|
+
*/
|
|
9
|
+
export declare function isDefined<T>(value: T | NullOrUndefined): value is T;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDefined = isDefined;
|
|
4
|
+
const isNil_1 = require("./isNil");
|
|
5
|
+
/**
|
|
6
|
+
* Type guard that checks if a value is defined (not null or undefined).
|
|
7
|
+
*
|
|
8
|
+
* @template T - The type of the value when it is defined
|
|
9
|
+
* @param value - The value to check
|
|
10
|
+
* @returns True if the value is defined (not null or undefined), false otherwise
|
|
11
|
+
*/
|
|
12
|
+
function isDefined(value) {
|
|
13
|
+
return !(0, isNil_1.isNil)(value);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=isDefined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDefined.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/nullish/isDefined.ts"],"names":[],"mappings":";;AAUA,8BAEC;AAXD,mCAAgC;AAEhC;;;;;;GAMG;AACH,SAAgB,SAAS,CAAI,KAA0B;IACrD,OAAO,CAAC,IAAA,aAAK,EAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type NullOrUndefined } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard that checks if a value is null or undefined.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The value to check
|
|
6
|
+
* @returns True if the value is null or undefined, false otherwise
|
|
7
|
+
*/
|
|
8
|
+
export declare function isNil(value: unknown): value is NullOrUndefined;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use {@link isNil} instead.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isNullOrUndefined<T>(value: T | NullOrUndefined): value is NullOrUndefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNil = isNil;
|
|
4
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
5
|
+
/**
|
|
6
|
+
* Type guard that checks if a value is null or undefined.
|
|
7
|
+
*
|
|
8
|
+
* @param value - The value to check
|
|
9
|
+
* @returns True if the value is null or undefined, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
function isNil(value) {
|
|
12
|
+
return value === null || value === undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use {@link isNil} instead.
|
|
16
|
+
*/
|
|
17
|
+
function isNullOrUndefined(value) {
|
|
18
|
+
return isNil(value);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=isNil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNil.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/nullish/isNil.ts"],"names":[],"mappings":";;AAQA,sBAEC;AAKD,8CAEC;AAfD;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAI,KAA0B;IAC7D,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullToUndefined.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/nullish/nullToUndefined.ts"],"names":[],"mappings":";;AAOA,0CAEC;AATD;;;;;GAKG;AACH,wDAAwD;AACjD,KAAK,UAAU,eAAe,CAAI,KAA4B;IACnE,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isString = isString;
|
|
4
|
+
/**
|
|
5
|
+
* Type guard that checks if a value is a string.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to check
|
|
8
|
+
* @returns `true` if the value is a string object or primitive, `false` otherwise
|
|
9
|
+
*/
|
|
10
|
+
function isString(value) {
|
|
11
|
+
return typeof value === "string" || value instanceof String;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=isString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isString.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/strings/isString.ts"],"names":[],"mappings":";;AAMA,4BAEC;AARD;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a value to a JSON string, with special handling for BigInt values.
|
|
3
|
+
*
|
|
4
|
+
* @param value - The value to stringify
|
|
5
|
+
* @returns A JSON string representation of the value
|
|
6
|
+
* @throws {TypeError} When the value contains circular references
|
|
7
|
+
*/
|
|
8
|
+
export declare function stringify(value: unknown): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringify = stringify;
|
|
4
|
+
/**
|
|
5
|
+
* Converts a value to a JSON string, with special handling for BigInt values.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to stringify
|
|
8
|
+
* @returns A JSON string representation of the value
|
|
9
|
+
* @throws {TypeError} When the value contains circular references
|
|
10
|
+
*/
|
|
11
|
+
function stringify(value) {
|
|
12
|
+
return JSON.stringify(value, (_, value) => typeof value === "bigint" ? String(value) : value);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=stringify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.js","sourceRoot":"","sources":["../../../../../../packages/util-ts/src/lib/strings/stringify.ts"],"names":[],"mappings":";;AAOA,8BAIC;AAXD;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,KAAc;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,KAAc,EAAE,EAAE,CACjD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type NullOrUndefined = null | undefined;
|
package/src/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/types.ts"],"names":[],"mappings":""}
|
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/util-ts/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
package/src/lib/cbh-error.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Either } from "./either";
|
|
2
|
-
import { type OneOrArray } from "./head";
|
|
3
|
-
/**
|
|
4
|
-
* Error status codes in our service APIs.
|
|
5
|
-
*
|
|
6
|
-
* @see {@link https://www.notion.so/BP-REST-API-f769b7fe745c4cf38f6eca2e9ad8a843?pvs=4#e0b4e9ea30f041409ce39505650098ea}
|
|
7
|
-
*/
|
|
8
|
-
declare const ERROR_STATUS_CODES: readonly [400, 401, 403, 404, 409, 422, 429, 500];
|
|
9
|
-
export type ErrorStatusCode = (typeof ERROR_STATUS_CODES)[number];
|
|
10
|
-
export interface CbhIssue {
|
|
11
|
-
cause?: Error;
|
|
12
|
-
id?: string;
|
|
13
|
-
message: string;
|
|
14
|
-
statusCode?: ErrorStatusCode;
|
|
15
|
-
}
|
|
16
|
-
export declare class CbhError extends Error {
|
|
17
|
-
readonly issues: CbhIssue[];
|
|
18
|
-
constructor(messageOrIssues: OneOrArray<CbhIssue> | string);
|
|
19
|
-
}
|
|
20
|
-
export declare function toLeft<A = never>(issues: OneOrArray<CbhIssue> | string): Either<CbhError, A>;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=cbh-error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-error.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;;GAIG;AACH,QAAA,MAAM,kBAAkB,mDAAoD,CAAC;AAC7E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,MAAM,EAAE,QAAQ,EAAE,CAAC;gBAEvB,eAAe,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,MAAM;CAgB3D;AAED,wBAAgB,MAAM,CAAC,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAE5F"}
|
package/src/lib/cbh-error.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-error.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":";;;AAuCA,wBAEC;AAzCD,qCAA6C;AAG7C;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAU7E,MAAa,QAAS,SAAQ,KAAK;IACjB,MAAM,CAAa;IAEnC,YAAY,eAA8C;QACxD,MAAM,EAAE,GACN,OAAO,eAAe,KAAK,QAAQ;YACjC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;YAChC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;gBAC9B,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAE1B,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;QACpD,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QAC7E,6FAA6F;QAC7F,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAnBD,4BAmBC;AAED,SAAgB,MAAM,CAAY,MAAqC;IACrE,OAAO,IAAA,aAAI,EAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CbhError, type CbhIssue } from "./cbh-error";
|
|
2
|
-
import type { OneOrNonEmptyArray } from "./non-empty-array";
|
|
3
|
-
export type CbhResponse<T> = {
|
|
4
|
-
success: true;
|
|
5
|
-
data: T;
|
|
6
|
-
} | {
|
|
7
|
-
success: false;
|
|
8
|
-
error: CbhError;
|
|
9
|
-
};
|
|
10
|
-
export declare function toErrorCbhResponse(issues: OneOrNonEmptyArray<CbhIssue>): {
|
|
11
|
-
success: false;
|
|
12
|
-
error: CbhError;
|
|
13
|
-
};
|
|
14
|
-
export declare function toSuccessCbhResponse<T>(data: T): {
|
|
15
|
-
success: true;
|
|
16
|
-
data: T;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=cbh-response.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-response.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE9F,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG;IACxE,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,QAAQ,CAAC;CACjB,CAEA;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CAE3E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-response.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-response.ts"],"names":[],"mappings":";;AAKA,gDAKC;AAED,oDAEC;AAdD,2CAAsD;AAKtD,SAAgB,kBAAkB,CAAC,MAAoC;IAIrE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,oBAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;AACzD,CAAC;AAED,SAAgB,oBAAoB,CAAI,IAAO;IAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type NullOrUndefined = null | undefined;
|
|
2
|
-
/**
|
|
3
|
-
* Checks whether a value is null or undefined. If it is not defined, the return type ensures type safety.
|
|
4
|
-
*/
|
|
5
|
-
export declare function isNullOrUndefined<T>(value: T | NullOrUndefined): value is NullOrUndefined;
|
|
6
|
-
/**
|
|
7
|
-
* Checks whether a value is defined. If it is defined, the return type ensures type safety.
|
|
8
|
-
*/
|
|
9
|
-
export declare function isDefined<T>(value: T | NullOrUndefined): value is T;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=defined-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defined-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/defined-utils.ts"],"names":[],"mappings":"AACA,KAAK,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;AAExC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,eAAe,GAAG,KAAK,IAAI,eAAe,CAEzF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,eAAe,GAAG,KAAK,IAAI,CAAC,CAEnE"}
|
package/src/lib/defined-utils.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNullOrUndefined = isNullOrUndefined;
|
|
4
|
-
exports.isDefined = isDefined;
|
|
5
|
-
/**
|
|
6
|
-
* Checks whether a value is null or undefined. If it is not defined, the return type ensures type safety.
|
|
7
|
-
*/
|
|
8
|
-
function isNullOrUndefined(value) {
|
|
9
|
-
return value === null || value === undefined;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Checks whether a value is defined. If it is defined, the return type ensures type safety.
|
|
13
|
-
*/
|
|
14
|
-
function isDefined(value) {
|
|
15
|
-
return !isNullOrUndefined(value);
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=defined-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defined-utils.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/defined-utils.ts"],"names":[],"mappings":";;AAMA,8CAEC;AAKD,8BAEC;AAZD;;GAEG;AACH,SAAgB,iBAAiB,CAAI,KAA0B;IAC7D,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAI,KAA0B;IACrD,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
package/src/lib/delay.d.ts
DELETED
package/src/lib/delay.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/delay.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAsB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D"}
|
package/src/lib/delay.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.delay = delay;
|
|
4
|
-
/**
|
|
5
|
-
* Non-blocking delay by the specified number of milliseconds.
|
|
6
|
-
*/
|
|
7
|
-
async function delay(milliseconds) {
|
|
8
|
-
await new Promise((resolve) => {
|
|
9
|
-
setTimeout(resolve, milliseconds);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=delay.js.map
|
package/src/lib/delay.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delay.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/delay.ts"],"names":[],"mappings":";;AAGA,sBAIC;AAPD;;GAEG;AACI,KAAK,UAAU,KAAK,CAAC,YAAoB;IAC9C,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC5B,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/src/lib/either.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface Left<E> {
|
|
2
|
-
isRight: false;
|
|
3
|
-
left: E;
|
|
4
|
-
}
|
|
5
|
-
export interface Right<A> {
|
|
6
|
-
isRight: true;
|
|
7
|
-
right: A;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A value of either type `Left<E>` or type `Right<A>`; a disjoint union.
|
|
11
|
-
*
|
|
12
|
-
* A common use case is as an alternative to {@link Option} where `Left<E>` contains useful
|
|
13
|
-
* information. Convention dictates that `Left<E>` is used for failure and `Right<A>` for success.
|
|
14
|
-
*/
|
|
15
|
-
export type Either<E, A> = Left<E> | Right<A>;
|
|
16
|
-
/**
|
|
17
|
-
* Constructs an `Either` holding a `Left<E>` value, usually representing a failure.
|
|
18
|
-
*/
|
|
19
|
-
export declare function left<E, A = never>(left: E): Either<E, A>;
|
|
20
|
-
/**
|
|
21
|
-
* Constructs an `Either` holding a `Right<A>` value, usually representing a success.
|
|
22
|
-
*/
|
|
23
|
-
export declare function right<A, E = never>(right: A): Either<E, A>;
|
|
24
|
-
/**
|
|
25
|
-
* Returns `true` if the either is `Left<E>`, `false` otherwise.
|
|
26
|
-
*/
|
|
27
|
-
export declare function isLeft<E, A>(either: Either<E, A>): either is Left<E>;
|
|
28
|
-
/**
|
|
29
|
-
* Returns `true` if the either is `Right<A>`, `false` otherwise.
|
|
30
|
-
*/
|
|
31
|
-
export declare function isRight<E, A>(either: Either<E, A>): either is Right<A>;
|
|
32
|
-
//# sourceMappingURL=either.d.ts.map
|
package/src/lib/either.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"either.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/either.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT;AAED,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACV;AAED;;;;;GAKG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAE9C;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAExD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAE1D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAEpE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAEtE"}
|
package/src/lib/either.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.left = left;
|
|
4
|
-
exports.right = right;
|
|
5
|
-
exports.isLeft = isLeft;
|
|
6
|
-
exports.isRight = isRight;
|
|
7
|
-
/**
|
|
8
|
-
* Constructs an `Either` holding a `Left<E>` value, usually representing a failure.
|
|
9
|
-
*/
|
|
10
|
-
function left(left) {
|
|
11
|
-
return { isRight: false, left };
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Constructs an `Either` holding a `Right<A>` value, usually representing a success.
|
|
15
|
-
*/
|
|
16
|
-
function right(right) {
|
|
17
|
-
return { isRight: true, right };
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Returns `true` if the either is `Left<E>`, `false` otherwise.
|
|
21
|
-
*/
|
|
22
|
-
function isLeft(either) {
|
|
23
|
-
return !either.isRight;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns `true` if the either is `Right<A>`, `false` otherwise.
|
|
27
|
-
*/
|
|
28
|
-
function isRight(either) {
|
|
29
|
-
return either.isRight;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=either.js.map
|
package/src/lib/either.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"either.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/either.ts"],"names":[],"mappings":";;AAqBA,oBAEC;AAKD,sBAEC;AAKD,wBAEC;AAKD,0BAEC;AA1BD;;GAEG;AACH,SAAgB,IAAI,CAAe,IAAO;IACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAe,KAAQ;IAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM,CAAO,MAAoB;IAC/C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAO,MAAoB;IAChD,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"force-cast.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/force-cast.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAE9C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"force-cast.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/force-cast.ts"],"names":[],"mappings":";;AAGA,8BAEC;AALD;;GAEG;AACH,SAAgB,SAAS,CAAI,KAAc;IACzC,OAAO,KAAU,CAAC;AACpB,CAAC"}
|
package/src/lib/head.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/head.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAEpC;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAE5D"}
|
package/src/lib/head.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"head.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/head.ts"],"names":[],"mappings":";;AAQA,oBAEC;AALD;;GAEG;AACH,SAAgB,IAAI,CAAI,KAAqB;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;AAChE,CAAC"}
|
package/src/lib/identity.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns value unchanged, useful in functional programming scenarios such as:
|
|
3
|
-
* - Creating higher-order functions like map, filter, and reduce.
|
|
4
|
-
* - Composing functions by providing an "identity element" in function composition.
|
|
5
|
-
*/
|
|
6
|
-
export declare function identity<T>(value: T): T;
|
|
7
|
-
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEvC"}
|
package/src/lib/identity.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.identity = identity;
|
|
4
|
-
/**
|
|
5
|
-
* Returns value unchanged, useful in functional programming scenarios such as:
|
|
6
|
-
* - Creating higher-order functions like map, filter, and reduce.
|
|
7
|
-
* - Composing functions by providing an "identity element" in function composition.
|
|
8
|
-
*/
|
|
9
|
-
function identity(value) {
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=identity.js.map
|
package/src/lib/identity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/identity.ts"],"names":[],"mappings":";;AAKA,4BAEC;AAPD;;;;GAIG;AACH,SAAgB,QAAQ,CAAI,KAAQ;IAClC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/src/lib/is-string.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-string.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/is-string.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD"}
|
package/src/lib/is-string.js
DELETED
package/src/lib/is-string.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-string.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/is-string.ts"],"names":[],"mappings":";;AAAA,4BAEC;AAFD,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;AAC9D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"non-empty-array.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/non-empty-array.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAEzD;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAEjF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"non-empty-array.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/non-empty-array.ts"],"names":[],"mappings":";;AAaA,0CAEC;AALD;;GAEG;AACH,SAAgB,eAAe,CAAI,KAA4B;IAC7D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"null-to-undefined.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/null-to-undefined.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAsB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAE7F"}
|