@clipboard-health/util-ts 0.0.0 → 0.2.0
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/CHANGELOG.md +17 -0
- package/README.md +13 -9
- package/package.json +5 -6
- package/src/index.d.ts +2 -12
- package/src/index.d.ts.map +1 -1
- package/src/index.js +2 -12
- package/src/index.js.map +1 -1
- package/src/lib/cbh-error.d.ts +4 -9
- package/src/lib/cbh-error.d.ts.map +1 -1
- package/src/lib/cbh-error.js +5 -4
- package/src/lib/cbh-error.js.map +1 -1
- package/src/lib/cbh-response.d.ts +2 -2
- package/src/lib/cbh-response.d.ts.map +1 -1
- package/src/lib/cbh-response.js +3 -2
- package/src/lib/cbh-response.js.map +1 -1
- package/src/lib/force-cast.d.ts +1 -1
- package/src/lib/force-cast.d.ts.map +1 -1
- package/src/lib/force-cast.js +5 -3
- package/src/lib/force-cast.js.map +1 -1
- package/src/lib/is-null-or-undefined.d.ts +2 -0
- package/src/lib/is-null-or-undefined.d.ts.map +1 -0
- package/src/lib/is-null-or-undefined.js +8 -0
- package/src/lib/is-null-or-undefined.js.map +1 -0
- package/src/lib/attributes.d.ts +0 -3
- package/src/lib/attributes.d.ts.map +0 -1
- package/src/lib/attributes.js +0 -3
- package/src/lib/attributes.js.map +0 -1
- package/src/lib/defined-utils.d.ts +0 -19
- package/src/lib/defined-utils.d.ts.map +0 -1
- package/src/lib/defined-utils.js +0 -21
- package/src/lib/defined-utils.js.map +0 -1
- package/src/lib/delay.d.ts +0 -2
- package/src/lib/delay.d.ts.map +0 -1
- package/src/lib/delay.js +0 -9
- 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/head.d.ts +0 -3
- package/src/lib/head.d.ts.map +0 -1
- package/src/lib/head.js +0 -7
- package/src/lib/head.js.map +0 -1
- package/src/lib/identity.d.ts +0 -12
- package/src/lib/identity.d.ts.map +0 -1
- package/src/lib/identity.js +0 -17
- 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 +0 -4
- package/src/lib/non-empty-array.d.ts.map +0 -1
- package/src/lib/non-empty-array.js +0 -7
- package/src/lib/non-empty-array.js.map +0 -1
- package/src/lib/null-to-undefined.d.ts +0 -11
- package/src/lib/null-to-undefined.d.ts.map +0 -1
- package/src/lib/null-to-undefined.js +0 -17
- 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 -2
- package/src/lib/stringify.d.ts.map +0 -1
- package/src/lib/stringify.js +0 -7
- package/src/lib/stringify.js.map +0 -1
- package/src/lib/to-error.d.ts +0 -4
- package/src/lib/to-error.d.ts.map +0 -1
- package/src/lib/to-error.js +0 -24
- package/src/lib/to-error.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
## [0.2.0](https://github.com/ClipboardHealth/cbh-core/compare/util-ts-0.1.0...util-ts-0.2.0) (2023-04-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Add `MessageProducer` class ([#24](https://github.com/ClipboardHealth/cbh-core/issues/24)) ([6b9ca48](https://github.com/ClipboardHealth/cbh-core/commit/6b9ca4814a7e4e6e9dd876c3a74dc10f018b023b))
|
|
11
|
+
|
|
12
|
+
## 0.1.0 (2023-04-19)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **DEV-19:** implement `crypto-kms` lib ([#22](https://github.com/ClipboardHealth/cbh-core/issues/22)) ([79a19d3](https://github.com/ClipboardHealth/cbh-core/commit/79a19d30b340b39e792cb5bb7ee01fe178d6bd27))
|
package/README.md
CHANGED
|
@@ -4,18 +4,22 @@ TypeScript utilities.
|
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
|
-
- [Install](#install)
|
|
8
7
|
- [Usage](#usage)
|
|
9
|
-
- [
|
|
8
|
+
- [Common commands](#common-commands)
|
|
10
9
|
|
|
11
|
-
##
|
|
10
|
+
## Usage
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
npm install @clipboard-health/util-ts
|
|
15
|
-
```
|
|
12
|
+
### Common commands
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
**Note**: See `package.json` `scripts` for a full list of commands.
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
```bash
|
|
17
|
+
# Build
|
|
18
|
+
npm run build
|
|
19
|
+
|
|
20
|
+
# Lint
|
|
21
|
+
npm run lint
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
# Test
|
|
24
|
+
npm run test
|
|
25
|
+
```
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/util-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
"access": "restricted"
|
|
7
|
-
},
|
|
8
5
|
"scripts": {
|
|
9
6
|
"build": "nx build util-ts",
|
|
10
7
|
"lint": "nx lint util-ts",
|
|
11
8
|
"test": "nx test util-ts"
|
|
12
9
|
},
|
|
13
|
-
"
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"tslib": "2.5.0"
|
|
12
|
+
},
|
|
14
13
|
"types": "./src/index.d.ts"
|
|
15
|
-
}
|
|
14
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
export * from "./lib/attributes";
|
|
2
1
|
export * from "./lib/cbh-error";
|
|
3
2
|
export * from "./lib/cbh-response";
|
|
4
|
-
export * from "./lib/defined-utils";
|
|
5
|
-
export * from "./lib/delay";
|
|
6
|
-
export * from "./lib/either";
|
|
7
3
|
export * from "./lib/force-cast";
|
|
8
|
-
export * from "./lib/
|
|
9
|
-
export * from "./lib/
|
|
10
|
-
export * from "./lib/is-string";
|
|
11
|
-
export * from "./lib/non-empty-array";
|
|
12
|
-
export * from "./lib/null-to-undefined";
|
|
13
|
-
export * from "./lib/option";
|
|
14
|
-
export * from "./lib/stringify";
|
|
15
|
-
export * from "./lib/to-error";
|
|
4
|
+
export * from "./lib/is-null-or-undefined";
|
|
5
|
+
export * from "./lib/types.d";
|
|
16
6
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/util-ts/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
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,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./lib/attributes"), exports);
|
|
5
4
|
tslib_1.__exportStar(require("./lib/cbh-error"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./lib/cbh-response"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./lib/defined-utils"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./lib/delay"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./lib/either"), exports);
|
|
10
6
|
tslib_1.__exportStar(require("./lib/force-cast"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./lib/
|
|
12
|
-
tslib_1.__exportStar(require("./lib/
|
|
13
|
-
tslib_1.__exportStar(require("./lib/is-string"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./lib/non-empty-array"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./lib/null-to-undefined"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./lib/option"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./lib/stringify"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./lib/to-error"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/is-null-or-undefined"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./lib/types.d"), exports);
|
|
19
9
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/util-ts/src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/util-ts/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,6DAAmC;AACnC,2DAAiC;AACjC,qEAA2C;AAC3C,wDAA8B"}
|
package/src/lib/cbh-error.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type ErrorStatusCode = (typeof ERROR_STATUS_CODES)[number];
|
|
4
|
-
export interface CbhIssue {
|
|
1
|
+
import type { NonEmptyArray, OneOrNonEmptyArray } from "./types";
|
|
2
|
+
export type CbhIssue = {
|
|
5
3
|
cause?: Error;
|
|
6
|
-
id?: string;
|
|
7
4
|
message: string;
|
|
8
|
-
|
|
9
|
-
}
|
|
5
|
+
};
|
|
10
6
|
export declare class CbhError extends Error {
|
|
11
|
-
readonly issues: CbhIssue
|
|
7
|
+
readonly issues: NonEmptyArray<CbhIssue>;
|
|
12
8
|
constructor(issues: OneOrNonEmptyArray<CbhIssue>);
|
|
13
9
|
}
|
|
14
|
-
export {};
|
|
15
10
|
//# sourceMappingURL=cbh-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-error.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cbh-error.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;gBAEpC,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC;CASjD"}
|
package/src/lib/cbh-error.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CbhError = void 0;
|
|
4
|
-
const non_empty_array_1 = require("./non-empty-array");
|
|
5
|
-
const ERROR_STATUS_CODES = [400, 401, 403, 404, 409, 422, 429, 500];
|
|
6
4
|
class CbhError extends Error {
|
|
7
5
|
issues;
|
|
8
6
|
constructor(issues) {
|
|
9
|
-
const is =
|
|
7
|
+
const is = toNonEmptyArray(issues);
|
|
10
8
|
const first = is[0];
|
|
11
9
|
super(first?.message, { cause: first?.cause });
|
|
12
|
-
//
|
|
10
|
+
// see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#example
|
|
13
11
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
14
12
|
this.issues = is;
|
|
15
13
|
this.name = "CbhError";
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
exports.CbhError = CbhError;
|
|
17
|
+
function toNonEmptyArray(value) {
|
|
18
|
+
return Array.isArray(value) ? value : [value];
|
|
19
|
+
}
|
|
19
20
|
//# sourceMappingURL=cbh-error.js.map
|
package/src/lib/cbh-error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-error.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cbh-error.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-error.ts"],"names":[],"mappings":";;;AAOA,MAAa,QAAS,SAAQ,KAAK;IACjB,MAAM,CAA0B;IAEhD,YAAY,MAAoC;QAC9C,MAAM,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACpB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/C,6FAA6F;QAC7F,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAZD,4BAYC;AAED,SAAS,eAAe,CAAI,KAA4B;IACtD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CbhError,
|
|
2
|
-
import type { OneOrNonEmptyArray } from "./
|
|
1
|
+
import { CbhError, CbhIssue } from "./cbh-error";
|
|
2
|
+
import type { OneOrNonEmptyArray } from "./types";
|
|
3
3
|
export type CbhResponse<T> = {
|
|
4
4
|
success: true;
|
|
5
5
|
data: T;
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,WAAW,CAAC,CAAC,IACrB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAExC,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"}
|
package/src/lib/cbh-response.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toErrorCbhResponse =
|
|
4
|
-
exports.toSuccessCbhResponse = toSuccessCbhResponse;
|
|
3
|
+
exports.toSuccessCbhResponse = exports.toErrorCbhResponse = void 0;
|
|
5
4
|
const cbh_error_1 = require("./cbh-error");
|
|
6
5
|
function toErrorCbhResponse(issues) {
|
|
7
6
|
return { success: false, error: new cbh_error_1.CbhError(issues) };
|
|
8
7
|
}
|
|
8
|
+
exports.toErrorCbhResponse = toErrorCbhResponse;
|
|
9
9
|
function toSuccessCbhResponse(data) {
|
|
10
10
|
return { success: true, data };
|
|
11
11
|
}
|
|
12
|
+
exports.toSuccessCbhResponse = toSuccessCbhResponse;
|
|
12
13
|
//# sourceMappingURL=cbh-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbh-response.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cbh-response.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/cbh-response.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AAOjD,SAAgB,kBAAkB,CAAC,MAAoC;IAIrE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,oBAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;AACzD,CAAC;AALD,gDAKC;AAED,SAAgB,oBAAoB,CAAI,IAAO;IAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC;AAFD,oDAEC"}
|
package/src/lib/force-cast.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"force-cast.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/force-cast.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,wBAAgB,SAAS,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"force-cast.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/force-cast.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC,CAG5C"}
|
package/src/lib/force-cast.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.forceCast =
|
|
3
|
+
exports.forceCast = void 0;
|
|
4
4
|
/** Force cast to the provided type. */
|
|
5
|
-
function forceCast(
|
|
6
|
-
|
|
5
|
+
function forceCast(val) {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
7
|
+
return val;
|
|
7
8
|
}
|
|
9
|
+
exports.forceCast = forceCast;
|
|
8
10
|
//# sourceMappingURL=force-cast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"force-cast.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/force-cast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"force-cast.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/force-cast.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,SAAgB,SAAS,CAAI,GAAY;IACvC,yEAAyE;IACzE,OAAO,GAAQ,CAAC;AAClB,CAAC;AAHD,8BAGC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-null-or-undefined.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/is-null-or-undefined.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,IAAI,GAAG,SAAS,CAEvE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNullOrUndefined = void 0;
|
|
4
|
+
function isNullOrUndefined(val) {
|
|
5
|
+
return val === null || val === undefined;
|
|
6
|
+
}
|
|
7
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
8
|
+
//# sourceMappingURL=is-null-or-undefined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-null-or-undefined.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/is-null-or-undefined.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAAC,GAAY;IAC5C,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,CAAC;AAC3C,CAAC;AAFD,8CAEC"}
|
package/src/lib/attributes.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/attributes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAEvF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC"}
|
package/src/lib/attributes.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/attributes.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* We specifically want to guard against both `null` and `undefined`
|
|
3
|
-
* In this one case, we need to define `null` as an expected argument type.
|
|
4
|
-
*/
|
|
5
|
-
type NullOrUndefined = null | undefined;
|
|
6
|
-
/**
|
|
7
|
-
* Checks whether a value is null or undefined. If it is not defined, the return type ensures type safety.
|
|
8
|
-
* @param value any value or null or undefined
|
|
9
|
-
* @returns true if `value` is null or undefined, false otherwise.
|
|
10
|
-
*/
|
|
11
|
-
export declare function isNullOrUndefined<T>(value: T | NullOrUndefined): value is NullOrUndefined;
|
|
12
|
-
/**
|
|
13
|
-
* Checks whether a value is defined. If it is defined, the return type ensures type safety.
|
|
14
|
-
* @param value any value or null or undefined
|
|
15
|
-
* @returns true if `value` is defined (not null and not undefined), false otherwise.
|
|
16
|
-
*/
|
|
17
|
-
export declare function isDefined<T>(value: T | NullOrUndefined): value is T;
|
|
18
|
-
export {};
|
|
19
|
-
//# 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":"AAAA;;;GAGG;AAEH,KAAK,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,eAAe,GAAG,KAAK,IAAI,eAAe,CAEzF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,eAAe,GAAG,KAAK,IAAI,CAAC,CAEnE"}
|
package/src/lib/defined-utils.js
DELETED
|
@@ -1,21 +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
|
-
* @param value any value or null or undefined
|
|
8
|
-
* @returns true if `value` is null or undefined, false otherwise.
|
|
9
|
-
*/
|
|
10
|
-
function isNullOrUndefined(value) {
|
|
11
|
-
return value === null || value === undefined;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Checks whether a value is defined. If it is defined, the return type ensures type safety.
|
|
15
|
-
* @param value any value or null or undefined
|
|
16
|
-
* @returns true if `value` is defined (not null and not undefined), false otherwise.
|
|
17
|
-
*/
|
|
18
|
-
function isDefined(value) {
|
|
19
|
-
return !isNullOrUndefined(value);
|
|
20
|
-
}
|
|
21
|
-
//# 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":";;AAYA,8CAEC;AAOD,8BAEC;AAhBD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAI,KAA0B;IAC7D,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAED;;;;GAIG;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,wBAAsB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D"}
|
package/src/lib/delay.js
DELETED
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":";;AAAA,sBAIC;AAJM,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"}
|
package/src/lib/head.d.ts
DELETED
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,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAEpC,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAE5D"}
|
package/src/lib/head.js
DELETED
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":";;AAEA,oBAEC;AAFD,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,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A generic function that returns its input unchanged.
|
|
3
|
-
* This function is useful in various functional programming scenarios, such as:
|
|
4
|
-
* - Creating higher-order functions like map, filter, and reduce.
|
|
5
|
-
* - Composing functions by providing an "identity element" in function composition.
|
|
6
|
-
*
|
|
7
|
-
* @template T - The type of the input value.
|
|
8
|
-
* @param {T} value - The value to return unchanged.
|
|
9
|
-
* @returns {T} The input value, unchanged.
|
|
10
|
-
*/
|
|
11
|
-
export declare function identity<T>(value: T): T;
|
|
12
|
-
//# 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;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEvC"}
|
package/src/lib/identity.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.identity = identity;
|
|
4
|
-
/**
|
|
5
|
-
* A generic function that returns its input unchanged.
|
|
6
|
-
* This function is useful in various functional programming scenarios, such as:
|
|
7
|
-
* - Creating higher-order functions like map, filter, and reduce.
|
|
8
|
-
* - Composing functions by providing an "identity element" in function composition.
|
|
9
|
-
*
|
|
10
|
-
* @template T - The type of the input value.
|
|
11
|
-
* @param {T} value - The value to return unchanged.
|
|
12
|
-
* @returns {T} The input value, unchanged.
|
|
13
|
-
*/
|
|
14
|
-
function identity(value) {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
//# 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":";;AAUA,4BAEC;AAZD;;;;;;;;;GASG;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,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AAE3C,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAEzD,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":";;AAIA,0CAEC;AAFD,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,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turns a null-returning promise into a promise returning undefined.
|
|
3
|
-
*
|
|
4
|
-
* Some of the database packages that we use return promises (Prisma)
|
|
5
|
-
* or promise-like objects (mongoose) that can resolve to null.
|
|
6
|
-
* This function is useful for getting rid of nulls which are banned by our linter rules.
|
|
7
|
-
*
|
|
8
|
-
* @param value A promise or a promise-like object.
|
|
9
|
-
*/
|
|
10
|
-
export declare function nullToUndefined<T>(value: PromiseLike<T | null>): Promise<T | undefined>;
|
|
11
|
-
//# sourceMappingURL=null-to-undefined.d.ts.map
|
|
@@ -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;;;;;;;;GAQG;AAEH,wBAAsB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAE7F"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nullToUndefined = nullToUndefined;
|
|
4
|
-
/**
|
|
5
|
-
* Turns a null-returning promise into a promise returning undefined.
|
|
6
|
-
*
|
|
7
|
-
* Some of the database packages that we use return promises (Prisma)
|
|
8
|
-
* or promise-like objects (mongoose) that can resolve to null.
|
|
9
|
-
* This function is useful for getting rid of nulls which are banned by our linter rules.
|
|
10
|
-
*
|
|
11
|
-
* @param value A promise or a promise-like object.
|
|
12
|
-
*/
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
14
|
-
async function nullToUndefined(value) {
|
|
15
|
-
return (await value) ?? undefined;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=null-to-undefined.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"null-to-undefined.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/null-to-undefined.ts"],"names":[],"mappings":";;AAUA,0CAEC;AAZD;;;;;;;;GAQG;AACH,wDAAwD;AACjD,KAAK,UAAU,eAAe,CAAI,KAA4B;IACnE,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC;AACpC,CAAC"}
|
package/src/lib/option.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface None {
|
|
2
|
-
isSome: false;
|
|
3
|
-
}
|
|
4
|
-
export interface Some<A> {
|
|
5
|
-
isSome: true;
|
|
6
|
-
value: A;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* An optional value. If the value exists, it's of type `Some<A>`, otherwise it's of type `None`.
|
|
10
|
-
*/
|
|
11
|
-
export type Option<A> = None | Some<A>;
|
|
12
|
-
/**
|
|
13
|
-
* Constructs an `Option` of `None`, representing a missing value.
|
|
14
|
-
*/
|
|
15
|
-
export declare const none: None;
|
|
16
|
-
/**
|
|
17
|
-
* Constructs an `Option` holding a `Some<A>`, representing an optional value that exists.
|
|
18
|
-
*/
|
|
19
|
-
export declare function some<A>(value: A): Some<A>;
|
|
20
|
-
/**
|
|
21
|
-
* Returns `true` if the option is `None`, `false` otherwise.
|
|
22
|
-
*/
|
|
23
|
-
export declare function isNone<A>(option: Option<A>): option is None;
|
|
24
|
-
/**
|
|
25
|
-
* Returns `true` if the option is `Some<A>`, `false` otherwise.
|
|
26
|
-
*/
|
|
27
|
-
export declare function isSome<A>(option: Option<A>): option is Some<A>;
|
|
28
|
-
//# sourceMappingURL=option.d.ts.map
|
package/src/lib/option.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/option.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;CACV;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,IAAwB,CAAC;AAE5C;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAEzC;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,CAE3D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAE9D"}
|
package/src/lib/option.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
/**
|
|
8
|
-
* Constructs an `Option` of `None`, representing a missing value.
|
|
9
|
-
*/
|
|
10
|
-
exports.none = { isSome: false };
|
|
11
|
-
/**
|
|
12
|
-
* Constructs an `Option` holding a `Some<A>`, representing an optional value that exists.
|
|
13
|
-
*/
|
|
14
|
-
function some(value) {
|
|
15
|
-
return { isSome: true, value };
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Returns `true` if the option is `None`, `false` otherwise.
|
|
19
|
-
*/
|
|
20
|
-
function isNone(option) {
|
|
21
|
-
return !option.isSome;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Returns `true` if the option is `Some<A>`, `false` otherwise.
|
|
25
|
-
*/
|
|
26
|
-
function isSome(option) {
|
|
27
|
-
return option.isSome;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=option.js.map
|
package/src/lib/option.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/option.ts"],"names":[],"mappings":";;;AAsBA,oBAEC;AAKD,wBAEC;AAKD,wBAEC;AAxBD;;GAEG;AACU,QAAA,IAAI,GAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAE5C;;GAEG;AACH,SAAgB,IAAI,CAAI,KAAQ;IAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM,CAAI,MAAiB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM,CAAI,MAAiB;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC"}
|
package/src/lib/stringify.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/stringify.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIhD"}
|
package/src/lib/stringify.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringify = stringify;
|
|
4
|
-
function stringify(value) {
|
|
5
|
-
return JSON.stringify(value, (_, value) => typeof value === "bigint" ? String(value) : value);
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=stringify.js.map
|
package/src/lib/stringify.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/stringify.ts"],"names":[],"mappings":";;AAAA,8BAIC;AAJD,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"}
|
package/src/lib/to-error.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-error.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/to-error.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAEtD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAQ7C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAErD"}
|
package/src/lib/to-error.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isError = isError;
|
|
4
|
-
exports.toError = toError;
|
|
5
|
-
exports.toErrorMessage = toErrorMessage;
|
|
6
|
-
const is_string_1 = require("./is-string");
|
|
7
|
-
const stringify_1 = require("./stringify");
|
|
8
|
-
function isError(error) {
|
|
9
|
-
return error instanceof Error;
|
|
10
|
-
}
|
|
11
|
-
function toError(error) {
|
|
12
|
-
if (isError(error))
|
|
13
|
-
return error;
|
|
14
|
-
try {
|
|
15
|
-
return new Error((0, is_string_1.isString)(error) ? error : (0, stringify_1.stringify)(error));
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return new Error(String(error));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function toErrorMessage(error) {
|
|
22
|
-
return toError(error).message;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=to-error.js.map
|
package/src/lib/to-error.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-error.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/to-error.ts"],"names":[],"mappings":";;AAGA,0BAEC;AAED,0BAQC;AAED,wCAEC;AAnBD,2CAAuC;AACvC,2CAAwC;AAExC,SAAgB,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,KAAK,CAAC;AAChC,CAAC;AAED,SAAgB,OAAO,CAAC,KAAc;IACpC,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEjC,IAAI,CAAC;QACH,OAAO,IAAI,KAAK,CAAC,IAAA,oBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED,SAAgB,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChC,CAAC"}
|