@clipboard-health/util-ts 0.6.1 → 0.7.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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.7.1](https://github.com/ClipboardHealth/cbh-core/compare/util-ts-0.7.0...util-ts-0.7.1) (2023-07-05)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * export to-error, is-string, and stringify ([#191](https://github.com/ClipboardHealth/cbh-core/issues/191)) ([b89fd79](https://github.com/ClipboardHealth/cbh-core/commit/b89fd79b954c70b4469506ce96982cce9cf40137))
11
+
12
+ ## [0.7.0](https://github.com/ClipboardHealth/cbh-core/compare/util-ts-0.6.1...util-ts-0.7.0) (2023-07-05)
13
+
14
+
15
+ ### Features
16
+
17
+ * Add `isDefined` utility function ([#183](https://github.com/ClipboardHealth/cbh-core/issues/183)) ([335e94b](https://github.com/ClipboardHealth/cbh-core/commit/335e94ba37eb969a5c325e012afa86188b3bce59))
18
+
5
19
  ## [0.6.1](https://github.com/ClipboardHealth/cbh-core/compare/util-ts-0.6.0...util-ts-0.6.1) (2023-07-05)
6
20
 
7
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipboard-health/util-ts",
3
- "version": "0.6.1",
3
+ "version": "0.7.1",
4
4
  "main": "./src/index.js",
5
5
  "scripts": {
6
6
  "build": "nx build util-ts",
package/src/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  export * from "./lib/cbh-error";
2
2
  export * from "./lib/cbh-response";
3
+ export * from "./lib/defined-utils";
3
4
  export * from "./lib/force-cast";
4
- export * from "./lib/is-null-or-undefined";
5
+ export * from "./lib/is-string";
5
6
  export * from "./lib/non-empty-array";
7
+ export * from "./lib/stringify";
8
+ export * from "./lib/to-error";
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,uBAAuB,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,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
package/src/index.js CHANGED
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./lib/cbh-error"), exports);
5
5
  tslib_1.__exportStar(require("./lib/cbh-response"), exports);
6
+ tslib_1.__exportStar(require("./lib/defined-utils"), exports);
6
7
  tslib_1.__exportStar(require("./lib/force-cast"), exports);
7
- tslib_1.__exportStar(require("./lib/is-null-or-undefined"), exports);
8
+ tslib_1.__exportStar(require("./lib/is-string"), exports);
8
9
  tslib_1.__exportStar(require("./lib/non-empty-array"), exports);
10
+ tslib_1.__exportStar(require("./lib/stringify"), exports);
11
+ tslib_1.__exportStar(require("./lib/to-error"), exports);
9
12
  //# 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,0DAAgC;AAChC,6DAAmC;AACnC,2DAAiC;AACjC,qEAA2C;AAC3C,gEAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/util-ts/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,6DAAmC;AACnC,8DAAoC;AACpC,2DAAiC;AACjC,0DAAgC;AAChC,gEAAsC;AACtC,0DAAgC;AAChC,yDAA+B"}
@@ -0,0 +1,19 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDefined = exports.isNullOrUndefined = void 0;
4
+ /**
5
+ * Checks whether a value is null or undefined. If it is not defined, the return type ensures type safety.
6
+ * @param value any value or null or undefined
7
+ * @returns true if `value` is null or undefined, false otherwise.
8
+ */
9
+ function isNullOrUndefined(value) {
10
+ return value === null || value === undefined;
11
+ }
12
+ exports.isNullOrUndefined = isNullOrUndefined;
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
+ exports.isDefined = isDefined;
22
+ //# sourceMappingURL=defined-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defined-utils.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/defined-utils.ts"],"names":[],"mappings":";;;AAOA;;;;GAIG;AACH,SAAgB,iBAAiB,CAAI,KAA0B;IAC7D,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAFD,8CAEC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAI,KAA0B;IACrD,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAFD,8BAEC"}
@@ -1,2 +0,0 @@
1
- export declare function isNullOrUndefined(value: unknown): value is null | undefined;
2
- //# sourceMappingURL=is-null-or-undefined.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-null-or-undefined.d.ts","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/is-null-or-undefined.ts"],"names":[],"mappings":"AACA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,SAAS,CAE3E"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNullOrUndefined = void 0;
4
- // eslint-disable-next-line @typescript-eslint/ban-types
5
- function isNullOrUndefined(value) {
6
- return value === null || value === undefined;
7
- }
8
- exports.isNullOrUndefined = isNullOrUndefined;
9
- //# sourceMappingURL=is-null-or-undefined.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-null-or-undefined.js","sourceRoot":"","sources":["../../../../../packages/util-ts/src/lib/is-null-or-undefined.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC;AAFD,8CAEC"}