type-fns 1.21.0 → 1.21.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/dist/checks/hasMetadata.d.ts +1 -1
- package/dist/checks/hasMetadata.js +4 -1
- package/dist/checks/hasMetadata.js.map +1 -1
- package/dist/checks/isOfEnum.d.ts +1 -1
- package/dist/checks/isOfEnum.js.map +1 -1
- package/dist/checks/isPresent.assess.d.ts +2 -2
- package/dist/checks/isPresent.assess.js.map +1 -1
- package/dist/checks/isPresent.d.ts +2 -2
- package/dist/checks/isPresent.js +1 -3
- package/dist/checks/isPresent.js.map +1 -1
- package/dist/companions/omit.js.map +1 -1
- package/dist/companions/pick.js.map +1 -1
- package/dist/{domain → domain.objects}/constants.d.ts +1 -0
- package/dist/{domain → domain.objects}/constants.js +1 -0
- package/dist/domain.objects/constants.js.map +1 -0
- package/dist/guards/assure.d.ts +1 -1
- package/dist/guards/assure.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/types/ArrayWith.d.ts +2 -1
- package/dist/types/ArrayWith.js +1 -0
- package/dist/wrappers/withAssure.js +1 -3
- package/dist/wrappers/withAssure.js.map +1 -1
- package/package.json +62 -40
- package/dist/checks/hasId.test.d.ts +0 -1
- package/dist/checks/hasId.test.js +0 -16
- package/dist/checks/hasId.test.js.map +0 -1
- package/dist/checks/hasMetadata.test.d.ts +0 -1
- package/dist/checks/hasMetadata.test.js +0 -29
- package/dist/checks/hasMetadata.test.js.map +0 -1
- package/dist/checks/hasUuid.test.d.ts +0 -1
- package/dist/checks/hasUuid.test.js +0 -16
- package/dist/checks/hasUuid.test.js.map +0 -1
- package/dist/checks/isAPromise.test.d.ts +0 -1
- package/dist/checks/isAPromise.test.js +0 -25
- package/dist/checks/isAPromise.test.js.map +0 -1
- package/dist/checks/isNotNull.test.d.ts +0 -1
- package/dist/checks/isNotNull.test.js +0 -19
- package/dist/checks/isNotNull.test.js.map +0 -1
- package/dist/checks/isNotUndefined.test.d.ts +0 -1
- package/dist/checks/isNotUndefined.test.js +0 -19
- package/dist/checks/isNotUndefined.test.js.map +0 -1
- package/dist/checks/isOfEnum.test.d.ts +0 -1
- package/dist/checks/isOfEnum.test.js +0 -38
- package/dist/checks/isOfEnum.test.js.map +0 -1
- package/dist/checks/isPresent.test.d.ts +0 -1
- package/dist/checks/isPresent.test.js +0 -78
- package/dist/checks/isPresent.test.js.map +0 -1
- package/dist/companions/omit.test.d.ts +0 -1
- package/dist/companions/omit.test.js +0 -11
- package/dist/companions/omit.test.js.map +0 -1
- package/dist/companions/pick.test.d.ts +0 -1
- package/dist/companions/pick.test.js +0 -11
- package/dist/companions/pick.test.js.map +0 -1
- package/dist/domain/constants.js.map +0 -1
- package/dist/guards/assure.test.d.ts +0 -1
- package/dist/guards/assure.test.js +0 -131
- package/dist/guards/assure.test.js.map +0 -1
- package/dist/types/ArrayWith.test.d.ts +0 -1
- package/dist/types/ArrayWith.test.js +0 -37
- package/dist/types/ArrayWith.test.js.map +0 -1
- package/dist/types/DropFirst.test.d.ts +0 -1
- package/dist/types/DropFirst.test.js +0 -12
- package/dist/types/DropFirst.test.js.map +0 -1
- package/dist/types/Literalize.test.d.ts +0 -1
- package/dist/types/Literalize.test.js +0 -18
- package/dist/types/Literalize.test.js.map +0 -1
- package/dist/types/PickAny.test.d.ts +0 -1
- package/dist/types/PickAny.test.js +0 -36
- package/dist/types/PickAny.test.js.map +0 -1
- package/dist/types/PickOne.test.d.ts +0 -1
- package/dist/types/PickOne.test.js +0 -35
- package/dist/types/PickOne.test.js.map +0 -1
- package/dist/wrappers/withAssure.test.d.ts +0 -1
- package/dist/wrappers/withAssure.test.js +0 -49
- package/dist/wrappers/withAssure.test.js.map +0 -1
- package/dist/wrappers/withNot.test.d.ts +0 -1
- package/dist/wrappers/withNot.test.js +0 -17
- package/dist/wrappers/withNot.test.js.map +0 -1
|
@@ -5,7 +5,7 @@ declare const typicalMetadataKeys: readonly ["id", "uuid", "createdAt", "updated
|
|
|
5
5
|
/**
|
|
6
6
|
* these are the keys most commonly used metadata keys
|
|
7
7
|
*/
|
|
8
|
-
type TypicalMetadataKeys = typeof typicalMetadataKeys[number];
|
|
8
|
+
type TypicalMetadataKeys = (typeof typicalMetadataKeys)[number];
|
|
9
9
|
/**
|
|
10
10
|
* asserts that any optional metadata keys of the object will now be required
|
|
11
11
|
*
|
|
@@ -25,6 +25,9 @@ const typicalMetadataKeys = [
|
|
|
25
25
|
*
|
|
26
26
|
* see more information about the `HasMetadata` type in its jsdoc on-hover documentation
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
// biome-ignore lint/suspicious/noExplicitAny: generic constraint requires any for flexibility
|
|
29
|
+
const hasMetadata = (obj,
|
|
30
|
+
// biome-ignore lint/suspicious/noExplicitAny: type cast required for default parameter
|
|
31
|
+
keys = typicalMetadataKeys) => keys.every((key) => obj[key] !== undefined);
|
|
29
32
|
exports.hasMetadata = hasMetadata;
|
|
30
33
|
//# sourceMappingURL=hasMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasMetadata.js","sourceRoot":"","sources":["../../src/checks/hasMetadata.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC1B,IAAI;IACJ,MAAM;IACN,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;CACL,CAAC;
|
|
1
|
+
{"version":3,"file":"hasMetadata.js","sourceRoot":"","sources":["../../src/checks/hasMetadata.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC1B,IAAI;IACJ,MAAM;IACN,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;CACL,CAAC;AA4DX;;;;;;;;;;;;GAYG;AACH,8FAA8F;AACvF,MAAM,WAAW,GAAG,CAIzB,GAAM;AACN,uFAAuF;AACvF,OAAuB,mBAA4C,EACrB,EAAE,CAChD,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AARjC,QAAA,WAAW,eAQsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isOfEnum.js","sourceRoot":"","sources":["../../src/checks/isOfEnum.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"isOfEnum.js","sourceRoot":"","sources":["../../src/checks/isOfEnum.ts"],"names":[],"mappings":";;;AAAA,yDAA6E;AAE7E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,cAAc,GAAG,CAG5B,CAAI,EACoD,EAAE;IAC1D,MAAM,KAAK,GAAG,CAAC,KAA+B,EAAuB,EAAE,CACrE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAmB,CAAC,CAAC;IACjD,OAAO,IAAA,uBAAU,EAAC,KAAK,CAAC,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotNull } from './isNotNull';
|
|
2
|
-
import { IsDefined } from './isNotUndefined';
|
|
1
|
+
import { type NotNull } from './isNotNull';
|
|
2
|
+
import { type IsDefined } from './isNotUndefined';
|
|
3
3
|
declare const assess: <T>(t: T) => t is NotNull<IsDefined<T>>;
|
|
4
4
|
export { assess as isPresentAssess };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPresent.assess.js","sourceRoot":"","sources":["../../src/checks/isPresent.assess.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"isPresent.assess.js","sourceRoot":"","sources":["../../src/checks/isPresent.assess.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,qDAA6D;AAE7D,MAAM,MAAM,GAAG,CAAI,CAAI,EAA8B,EAAE,CACrD,IAAA,qBAAS,EAAC,CAAC,CAAC,IAAI,IAAA,0BAAS,EAAC,CAAC,CAAC,CAAC;AAGZ,iCAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NotNull } from './isNotNull';
|
|
2
|
-
import { IsDefined } from './isNotUndefined';
|
|
1
|
+
import type { NotNull } from './isNotNull';
|
|
2
|
+
import type { IsDefined } from './isNotUndefined';
|
|
3
3
|
import { isPresentAssess as assess } from './isPresent.assess';
|
|
4
4
|
declare const assure: <T>(input: T) => NotNull<IsDefined<T>>;
|
|
5
5
|
interface IsPresentWithAssure {
|
package/dist/checks/isPresent.js
CHANGED
|
@@ -10,9 +10,7 @@ const assure = (0, withAssure_1.asAssure)(isPresent_assess_1.isPresentAssess, {
|
|
|
10
10
|
* refs
|
|
11
11
|
* - https://github.com/microsoft/TypeScript/issues/16069#issuecomment-566222173
|
|
12
12
|
*/
|
|
13
|
-
const isPresentWithAssure =
|
|
14
|
-
return (0, isPresent_assess_1.isPresentAssess)(...input);
|
|
15
|
-
};
|
|
13
|
+
const isPresentWithAssure = ((...input) => (0, isPresent_assess_1.isPresentAssess)(...input));
|
|
16
14
|
exports.isPresent = isPresentWithAssure;
|
|
17
15
|
isPresentWithAssure.assess = isPresent_assess_1.isPresentAssess;
|
|
18
16
|
isPresentWithAssure.assure = assure;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/checks/isPresent.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/checks/isPresent.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AAIpD,yDAA+D;AAE/D,MAAM,MAAM,GAAG,IAAA,qBAAQ,EAAC,kCAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;AAQvD;;;;;GAKG;AACH,MAAM,mBAAmB,GAAwB,CAAC,CAChD,GAAG,KAAgC,EACR,EAAE,CAAC,IAAA,kCAAM,EAAC,GAAG,KAAK,CAAC,CAG/C,CAAC;AAI8B,wCAAS;AAHzC,mBAAmB,CAAC,MAAM,GAAG,kCAAM,CAAC;AACpC,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/companions/omit.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,IAAI,GAAG,CAIlB,GAAM,EACN,IAAO,EACa,EAAE,CACtB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../src/companions/omit.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,IAAI,GAAG,CAIlB,GAAM,EACN,IAAO,EACa,EAAE,CACtB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CACxB,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IACxB,iEAAiE;IACjE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAEvC,6CAA6C;IAC7C,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;AACtC,CAAC,EACD,EAAyB,CACnB,CAAC;AAhBE,QAAA,IAAI,QAgBN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../src/companions/pick.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,IAAI,GAAG,CAIlB,GAAM,EACN,IAAO,EACa,EAAE,CACtB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../src/companions/pick.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,IAAI,GAAG,CAIlB,GAAM,EACN,IAAO,EACa,EAAE,CACtB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CACxB,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IACxB,qEAAqE;IACrE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAExC,yCAAyC;IACzC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;AACtC,CAAC,EACD,EAAyB,CACnB,CAAC;AAhBE,QAAA,IAAI,QAgBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/domain.objects/constants.ts"],"names":[],"mappings":";;AAAA;;GAEG"}
|
package/dist/guards/assure.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssessIsOfTypeMethod } from '../wrappers/withAssure';
|
|
1
|
+
import { type AssessIsOfTypeMethod } from '../wrappers/withAssure';
|
|
2
2
|
/**
|
|
3
3
|
* what: a standalone assure function that takes a value and a type.check, returning the value if it passes or throwing if it doesn't
|
|
4
4
|
* why:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assure.js","sourceRoot":"","sources":["../../src/guards/assure.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"assure.js","sourceRoot":"","sources":["../../src/guards/assure.ts"],"names":[],"mappings":";;;AAAA,yDAGkC;AAElC;;;;;;;;;;;GAWG;AACI,MAAM,MAAM,GAAG,CACpB,KAAQ,EACR,KAAiC,EACjC,OAA0B,EACvB,EAAE;IACL,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;IACzC,IAAI,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/B,MAAM,IAAI,yCAA4B,CACpC,wDAAwD,IAAI,GAAG,EAC/D;QACE,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;KACjD,CACF,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,MAAM,UAcjB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
export * from './checks/hasId';
|
|
2
|
-
export * from './checks/hasUuid';
|
|
3
2
|
export * from './checks/hasMetadata';
|
|
4
|
-
export * from './checks/
|
|
5
|
-
export * from './checks/isOfEnum';
|
|
6
|
-
export * from './wrappers/withNot';
|
|
3
|
+
export * from './checks/hasUuid';
|
|
7
4
|
export * from './checks/isAFunction';
|
|
8
5
|
export * from './checks/isAPromise';
|
|
9
|
-
export * from './
|
|
6
|
+
export * from './checks/isKeyOf';
|
|
10
7
|
export * from './checks/isNotNull';
|
|
11
|
-
export * from './checks/isNotUndefined';
|
|
12
8
|
export * from './checks/isNotPromise';
|
|
13
|
-
export * from './
|
|
9
|
+
export * from './checks/isNotUndefined';
|
|
10
|
+
export * from './checks/isOfEnum';
|
|
11
|
+
export * from './checks/isPresent';
|
|
14
12
|
export * from './companions/omit';
|
|
15
13
|
export * from './companions/pick';
|
|
14
|
+
export * from './guards/assure';
|
|
15
|
+
export * from './types/DropFirst';
|
|
16
|
+
export * from './types/Empty';
|
|
16
17
|
export * from './types/Literalize';
|
|
17
|
-
export * from './wrappers/withAssure';
|
|
18
|
-
export * from './checks/isKeyOf';
|
|
19
18
|
export * from './types/PickAny';
|
|
20
|
-
export * from './types/
|
|
21
|
-
export * from './
|
|
19
|
+
export * from './types/PickOne';
|
|
20
|
+
export * from './wrappers/withAssure';
|
|
21
|
+
export * from './wrappers/withNot';
|
package/dist/index.js
CHANGED
|
@@ -15,24 +15,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./checks/hasId"), exports);
|
|
18
|
-
__exportStar(require("./checks/hasUuid"), exports);
|
|
19
18
|
__exportStar(require("./checks/hasMetadata"), exports);
|
|
20
|
-
__exportStar(require("./checks/
|
|
21
|
-
__exportStar(require("./checks/isOfEnum"), exports);
|
|
22
|
-
__exportStar(require("./wrappers/withNot"), exports);
|
|
19
|
+
__exportStar(require("./checks/hasUuid"), exports);
|
|
23
20
|
__exportStar(require("./checks/isAFunction"), exports);
|
|
24
21
|
__exportStar(require("./checks/isAPromise"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
22
|
+
__exportStar(require("./checks/isKeyOf"), exports);
|
|
26
23
|
__exportStar(require("./checks/isNotNull"), exports);
|
|
27
|
-
__exportStar(require("./checks/isNotUndefined"), exports);
|
|
28
24
|
__exportStar(require("./checks/isNotPromise"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
25
|
+
__exportStar(require("./checks/isNotUndefined"), exports);
|
|
26
|
+
__exportStar(require("./checks/isOfEnum"), exports);
|
|
27
|
+
__exportStar(require("./checks/isPresent"), exports);
|
|
30
28
|
__exportStar(require("./companions/omit"), exports);
|
|
31
29
|
__exportStar(require("./companions/pick"), exports);
|
|
30
|
+
__exportStar(require("./guards/assure"), exports);
|
|
31
|
+
__exportStar(require("./types/DropFirst"), exports);
|
|
32
|
+
__exportStar(require("./types/Empty"), exports);
|
|
32
33
|
__exportStar(require("./types/Literalize"), exports);
|
|
33
|
-
__exportStar(require("./wrappers/withAssure"), exports);
|
|
34
|
-
__exportStar(require("./checks/isKeyOf"), exports);
|
|
35
34
|
__exportStar(require("./types/PickAny"), exports);
|
|
36
|
-
__exportStar(require("./types/
|
|
37
|
-
__exportStar(require("./
|
|
35
|
+
__exportStar(require("./types/PickOne"), exports);
|
|
36
|
+
__exportStar(require("./wrappers/withAssure"), exports);
|
|
37
|
+
__exportStar(require("./wrappers/withNot"), exports);
|
|
38
38
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,mDAAiC;AACjC,uDAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,uDAAqC;AACrC,mDAAiC;AACjC,uDAAqC;AACrC,sDAAoC;AACpC,mDAAiC;AACjC,qDAAmC;AACnC,wDAAsC;AACtC,0DAAwC;AACxC,oDAAkC;AAClC,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,gDAA8B;AAC9B,qDAAmC;AACnC,kDAAgC;AAChC,kDAAgC;AAChC,wDAAsC;AACtC,qDAAmC"}
|
|
@@ -8,5 +8,6 @@ TLength extends number, TType, TCurrent extends TType[]> = TCurrent['length'] ex
|
|
|
8
8
|
/**
|
|
9
9
|
* declares a type of array with a check on its length
|
|
10
10
|
*/
|
|
11
|
-
type ArrayWith<TCheck extends 'len' | 'min', // todo: support 'max' too?
|
|
11
|
+
export type ArrayWith<TCheck extends 'len' | 'min', // todo: support 'max' too?
|
|
12
12
|
TLength extends number, TType> = BuildArrayWith<TCheck, TLength, TType, []>;
|
|
13
|
+
export {};
|
package/dist/types/ArrayWith.js
CHANGED
|
@@ -46,9 +46,7 @@ exports.asAssure = asAssure;
|
|
|
46
46
|
*/
|
|
47
47
|
const withAssure = (assess, options) => {
|
|
48
48
|
const assure = (0, exports.asAssure)(assess, options);
|
|
49
|
-
const result =
|
|
50
|
-
return assess(...input);
|
|
51
|
-
};
|
|
49
|
+
const result = ((...input) => assess(...input));
|
|
52
50
|
result.assess = assess;
|
|
53
51
|
result.assure = assure;
|
|
54
52
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAssure.js","sourceRoot":"","sources":["../../src/wrappers/withAssure.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAU9C,MAAa,4BAA6B,SAAQ,6BAAY;CAAG;AAAjE,oEAAiE;AAEjE;;;;;;;;;;GAUG;AACI,MAAM,QAAQ,GAAG,CACtB,MAAkC,EAClC,OAA0B,EACE,EAAE;IAC9B,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,wCAAwC;IACnF,MAAM,MAAM,GAAG,CAAC,KAAQ,EAAE,EAAE,CAC1B,MAAM,CAAC,KAAK,CAAC;QACX,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,CAAC,GAAG,EAAE;YACJ,MAAM,IAAI,4BAA4B,CACpC,wDAAwD,IAAI,GAAG,EAC/D;gBACE,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;aACjD,CACF,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACX,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlBW,QAAA,QAAQ,YAkBnB;AAEF;;;;;;;;;;;;;;GAcG;AACI,MAAM,UAAU,GAAG,CACxB,MAAkC,EAClC,OAA0B,EACF,EAAE;IAC1B,MAAM,MAAM,GAAG,IAAA,gBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"withAssure.js","sourceRoot":"","sources":["../../src/wrappers/withAssure.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAU9C,MAAa,4BAA6B,SAAQ,6BAAY;CAAG;AAAjE,oEAAiE;AAEjE;;;;;;;;;;GAUG;AACI,MAAM,QAAQ,GAAG,CACtB,MAAkC,EAClC,OAA0B,EACE,EAAE;IAC9B,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,wCAAwC;IACnF,MAAM,MAAM,GAAG,CAAC,KAAQ,EAAE,EAAE,CAC1B,MAAM,CAAC,KAAK,CAAC;QACX,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,CAAC,GAAG,EAAE;YACJ,MAAM,IAAI,4BAA4B,CACpC,wDAAwD,IAAI,GAAG,EAC/D;gBACE,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;aACjD,CACF,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACX,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlBW,QAAA,QAAQ,YAkBnB;AAEF;;;;;;;;;;;;;;GAcG;AACI,MAAM,UAAU,GAAG,CACxB,MAAkC,EAClC,OAA0B,EACF,EAAE;IAC1B,MAAM,MAAM,GAAG,IAAA,gBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,CAAC,CACd,GAAG,KAAgC,EACR,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAM/C,CAAC;IACF,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAjBW,QAAA,UAAU,cAiBrB"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "type-fns",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "A set of types, type checks, and type guards for simpler, safer, and easier to read code.",
|
|
5
|
-
"version": "1.21.
|
|
5
|
+
"version": "1.21.1",
|
|
6
6
|
"repository": "ehmpathy/type-fns",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/type-fns",
|
|
8
8
|
"keywords": [
|
|
@@ -26,64 +26,86 @@
|
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
28
|
"commit:with-cli": "npx cz",
|
|
29
|
-
"fix:format:
|
|
30
|
-
"fix:format": "npm run fix:format:
|
|
31
|
-
"fix:lint": "
|
|
29
|
+
"fix:format:biome": "biome check --write",
|
|
30
|
+
"fix:format": "npm run fix:format:biome",
|
|
31
|
+
"fix:lint": "biome check --write",
|
|
32
|
+
"fix": "npm run fix:format && npm run fix:lint",
|
|
32
33
|
"build:artifact": "echo 'no artifact'",
|
|
33
|
-
"build:clean": "rm
|
|
34
|
-
"build:
|
|
35
|
-
"build": "npm run build:clean && npm run build:
|
|
34
|
+
"build:clean:bun": "rm -f ./bin/*.bc",
|
|
35
|
+
"build:clean:tsc": "(chmod -R u+w dist 2>/dev/null || true) && rm -rf dist/",
|
|
36
|
+
"build:clean": "npm run build:clean:tsc && npm run build:clean:bun",
|
|
37
|
+
"build:compile:tsc": "tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json",
|
|
38
|
+
"build:compile": "npm run build:compile:tsc && npm run build:compile:bun --if-present",
|
|
39
|
+
"build": "npm run build:clean && npm run build:compile && npm run build:complete --if-present",
|
|
36
40
|
"test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
|
|
37
|
-
"test:types": "tsc -p ./tsconfig.
|
|
38
|
-
"test:format:
|
|
39
|
-
"test:format": "npm run test:format:
|
|
40
|
-
"test:lint:deps": "npx depcheck -c
|
|
41
|
-
"test:lint:
|
|
42
|
-
"test:lint": "
|
|
43
|
-
"test:
|
|
44
|
-
"test:
|
|
45
|
-
"test:
|
|
46
|
-
"test": "
|
|
47
|
-
"test
|
|
41
|
+
"test:types": "tsc -p ./tsconfig.json --noEmit",
|
|
42
|
+
"test:format:biome": "biome format",
|
|
43
|
+
"test:format": "npm run test:format:biome",
|
|
44
|
+
"test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
|
|
45
|
+
"test:lint:biome": "biome check --diagnostic-level=error",
|
|
46
|
+
"test:lint:biome:all": "biome check",
|
|
47
|
+
"test:lint": "npm run test:lint:biome && npm run test:lint:deps",
|
|
48
|
+
"test:unit": "set -eu && jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -n \"${CI:-}\" ] && echo '--ci') $([ -z \"${THOROUGH:-}\" ] && echo '--changedSince=main') $([ -n \"${RESNAP:-}\" ] && echo '--updateSnapshot')",
|
|
49
|
+
"test:integration": "set -eu && jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -n \"${CI:-}\" ] && echo '--ci') $([ -z \"${THOROUGH:-}\" ] && echo '--changedSince=main') $([ -n \"${RESNAP:-}\" ] && echo '--updateSnapshot')",
|
|
50
|
+
"test:acceptance:locally": "set -eu && npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n \"${RESNAP:-}\" ] && echo '--updateSnapshot')",
|
|
51
|
+
"test": "set -eu && npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
|
|
52
|
+
"test:acceptance": "set -eu && npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n \"${CI:-}\" ] && echo '--ci') $([ -n \"${RESNAP:-}\" ] && echo '--updateSnapshot')",
|
|
48
53
|
"prepush": "npm run test && npm run build",
|
|
49
54
|
"prepublish": "npm run build",
|
|
50
55
|
"preversion": "npm run prepush",
|
|
51
56
|
"postversion": "git push origin HEAD --tags --no-verify",
|
|
52
|
-
"
|
|
53
|
-
"prepare:
|
|
57
|
+
"prepare:husky": "husky install && chmod ug+x .husky/*",
|
|
58
|
+
"prepare:rhachet": "rhachet init --keys --hooks --roles mechanic behaver driver reviewer librarian ergonomist architect",
|
|
59
|
+
"prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
|
|
60
|
+
"test:lint:cycles": "dpdm --no-warning --no-tree --exit-code circular:1 --exclude '^$' 'src/**/*.ts'",
|
|
61
|
+
"upgrade:rhachet": "rhachet upgrade"
|
|
54
62
|
},
|
|
55
63
|
"dependencies": {
|
|
56
|
-
"
|
|
64
|
+
"domain-objects": "0.31.10",
|
|
65
|
+
"helpful-errors": "1.7.2",
|
|
66
|
+
"type-fns": "1.21.0"
|
|
57
67
|
},
|
|
58
68
|
"devDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@commitlint/
|
|
61
|
-
"@
|
|
69
|
+
"@biomejs/biome": "2.3.8",
|
|
70
|
+
"@commitlint/cli": "19.5.0",
|
|
71
|
+
"@commitlint/config-conventional": "19.5.0",
|
|
72
|
+
"@jest/globals": "30.2.0",
|
|
73
|
+
"@swc/core": "1.15.3",
|
|
74
|
+
"@swc/jest": "0.2.39",
|
|
62
75
|
"@tsconfig/node-lts-strictest": "18.12.1",
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
76
|
+
"@tsconfig/node20": "20.1.5",
|
|
77
|
+
"@tsconfig/strictest": "2.0.5",
|
|
78
|
+
"@types/jest": "30.0.0",
|
|
79
|
+
"@types/node": "22.15.21",
|
|
66
80
|
"core-js": "3.26.1",
|
|
67
|
-
"cz-conventional-changelog": "3.0
|
|
68
|
-
"declapract": "0.
|
|
69
|
-
"declapract-typescript-ehmpathy": "0.
|
|
81
|
+
"cz-conventional-changelog": "3.3.0",
|
|
82
|
+
"declapract": "0.13.18",
|
|
83
|
+
"declapract-typescript-ehmpathy": "0.47.58",
|
|
84
|
+
"declastruct": "1.7.3",
|
|
85
|
+
"declastruct-github": "1.3.5",
|
|
70
86
|
"depcheck": "1.4.3",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"eslint-config-prettier": "8.5.0",
|
|
74
|
-
"eslint-plugin-import": "2.26.0",
|
|
75
|
-
"eslint-plugin-prettier": "4.2.1",
|
|
87
|
+
"dpdm": "4.0.1",
|
|
88
|
+
"esbuild-register": "3.6.0",
|
|
76
89
|
"husky": "8.0.3",
|
|
77
|
-
"jest": "
|
|
78
|
-
"
|
|
79
|
-
"
|
|
90
|
+
"jest": "30.2.0",
|
|
91
|
+
"rhachet": "1.39.8",
|
|
92
|
+
"rhachet-brains-anthropic": "0.4.0",
|
|
93
|
+
"rhachet-brains-xai": "0.3.3",
|
|
94
|
+
"rhachet-roles-bhrain": "0.23.10",
|
|
95
|
+
"rhachet-roles-bhuild": "0.15.1",
|
|
96
|
+
"rhachet-roles-ehmpathy": "1.34.20",
|
|
97
|
+
"test-fns": "1.15.7",
|
|
80
98
|
"ts-jest": "29.1.3",
|
|
81
99
|
"ts-node": "10.9.2",
|
|
82
|
-
"
|
|
100
|
+
"tsc-alias": "1.8.10",
|
|
101
|
+
"tsx": "4.20.6",
|
|
102
|
+
"typescript": "5.4.5",
|
|
103
|
+
"yalc": "1.0.0-pre.53"
|
|
83
104
|
},
|
|
84
105
|
"config": {
|
|
85
106
|
"commitizen": {
|
|
86
107
|
"path": "./node_modules/cz-conventional-changelog"
|
|
87
108
|
}
|
|
88
|
-
}
|
|
109
|
+
},
|
|
110
|
+
"packageManager": "pnpm@10.24.0"
|
|
89
111
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const hasId_1 = require("./hasId");
|
|
4
|
-
describe('hasId', () => {
|
|
5
|
-
it('should return true if an object has an id', () => {
|
|
6
|
-
const obj = { id: 821, name: 'bob' };
|
|
7
|
-
const itHasId = (0, hasId_1.hasId)(obj);
|
|
8
|
-
expect(itHasId).toEqual(true);
|
|
9
|
-
});
|
|
10
|
-
it('should return false if an object does not have an id', () => {
|
|
11
|
-
const obj = { name: 'bob' };
|
|
12
|
-
const itHasId = (0, hasId_1.hasId)(obj);
|
|
13
|
-
expect(itHasId).toEqual(false);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=hasId.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasId.test.js","sourceRoot":"","sources":["../../src/checks/hasId.test.ts"],"names":[],"mappings":";;AAAA,mCAAgC;AAEhC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,GAAG,GAAkC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACpE,MAAM,OAAO,GAAG,IAAA,aAAK,EAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,GAAG,GAAkC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC3D,MAAM,OAAO,GAAG,IAAA,aAAK,EAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const __1 = require("..");
|
|
4
|
-
describe('HasMetadata', () => {
|
|
5
|
-
it('should enable accessing an optional metadata property of a type', () => {
|
|
6
|
-
const pot = { id: 123, age: 72 };
|
|
7
|
-
expect(pot.id.toFixed).toBeDefined(); // no type errors
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
describe('OmitMetadata', () => {
|
|
11
|
-
it('should prevent specifying a metadata property of a type', () => {
|
|
12
|
-
// @ts-expect-error - should not be able to set id
|
|
13
|
-
const pot = { id: 123, age: 72 };
|
|
14
|
-
});
|
|
15
|
-
it('should prevent accessing a metadata property of a type', () => {
|
|
16
|
-
const pot = { age: 72 };
|
|
17
|
-
// @ts-expect-error - should not be able to get id
|
|
18
|
-
expect(pot.id).not.toBeDefined();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe('hasMetadata', () => {
|
|
22
|
-
it('should enable accessing an optional metadata property of a type', () => {
|
|
23
|
-
const pot = { id: 123, age: 72 };
|
|
24
|
-
if (!(0, __1.hasMetadata)(pot, ['id']))
|
|
25
|
-
throw new Error('doesnt have metadata');
|
|
26
|
-
expect(pot.id.toFixed).toBeDefined();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=hasMetadata.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasMetadata.test.js","sourceRoot":"","sources":["../../src/checks/hasMetadata.test.ts"],"names":[],"mappings":";;AAAA,0BAAiC;AAGjC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QAEzE,MAAM,GAAG,GAA2B,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,iBAAiB;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QAGjE,kDAAkD;QAClD,MAAM,GAAG,GAA4B,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAGhE,MAAM,GAAG,GAA4B,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;QAEjD,kDAAkD;QAClD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QAEzE,MAAM,GAAG,GAAc,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAA,eAAW,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACvE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const hasUuid_1 = require("./hasUuid");
|
|
4
|
-
describe('hasUuid', () => {
|
|
5
|
-
it('should return true if an object has an id', () => {
|
|
6
|
-
const obj = { uuid: 'uuid', name: 'bob' };
|
|
7
|
-
const itHasUuid = (0, hasUuid_1.hasUuid)(obj);
|
|
8
|
-
expect(itHasUuid).toEqual(true);
|
|
9
|
-
});
|
|
10
|
-
it('should return false if an object does not have an id', () => {
|
|
11
|
-
const obj = { name: 'bob' };
|
|
12
|
-
const itHasUuid = (0, hasUuid_1.hasUuid)(obj);
|
|
13
|
-
expect(itHasUuid).toEqual(false);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=hasUuid.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasUuid.test.js","sourceRoot":"","sources":["../../src/checks/hasUuid.test.ts"],"names":[],"mappings":";;AAAA,uCAAoC;AAEpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,GAAG,GAAoC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC3E,MAAM,SAAS,GAAG,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,GAAG,GAAoC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC7D,MAAM,SAAS,GAAG,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const isAPromise_1 = require("./isAPromise");
|
|
4
|
-
describe('isAPromise', () => {
|
|
5
|
-
it('should return true for promises', () => {
|
|
6
|
-
const descision = (0, isAPromise_1.isAPromise)(Promise.resolve('hello'));
|
|
7
|
-
expect(descision).toEqual(true);
|
|
8
|
-
});
|
|
9
|
-
it('should return false for not promises', () => {
|
|
10
|
-
const descision = (0, isAPromise_1.isAPromise)('hello');
|
|
11
|
-
expect(descision).toEqual(false);
|
|
12
|
-
});
|
|
13
|
-
it('should be usable to narrow the typescript type', () => {
|
|
14
|
-
// imagine we didn't know whether soonerOrLater is a promise or a string
|
|
15
|
-
const soonerOrLater = Promise.resolve('hello');
|
|
16
|
-
// we can use this check to narrow down the typescript type and do operations specific to each type
|
|
17
|
-
if ((0, isAPromise_1.isAPromise)(soonerOrLater)) {
|
|
18
|
-
void soonerOrLater.then(() => 'done');
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
void soonerOrLater.toLowerCase();
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=isAPromise.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isAPromise.test.js","sourceRoot":"","sources":["../../src/checks/isAPromise.test.ts"],"names":[],"mappings":";;AAAA,6CAA0C;AAE1C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACvD,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,OAAO,CAAC,CAAC;QACtC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,wEAAwE;QACxE,MAAM,aAAa,GAA6B,OAAO,CAAC,OAAO,CAC7D,OAAO,CACD,CAAC;QAET,mGAAmG;QACnG,IAAI,IAAA,uBAAU,EAAC,aAAa,CAAC,EAAE,CAAC;YAC9B,KAAK,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
|
-
const __1 = require("..");
|
|
5
|
-
describe('isNotNull', () => {
|
|
6
|
-
it('should constrain type correctly', async () => {
|
|
7
|
-
const maybeNumber = undefined; // valid
|
|
8
|
-
if ((0, __1.isNotNull)(maybeNumber)) {
|
|
9
|
-
const defNumber = maybeNumber; // valid
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
describe('NotNull', () => {
|
|
14
|
-
it('should constrain type correctly', async () => {
|
|
15
|
-
const notMaybeNumber = 821;
|
|
16
|
-
const onlyNumber = notMaybeNumber; // valid
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=isNotNull.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isNotNull.test.js","sourceRoot":"","sources":["../../src/checks/isNotNull.test.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,0BAAwC;AAExC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAG/C,MAAM,WAAW,GAAgB,SAAgB,CAAC,CAAC,QAAQ;QAE3D,IAAI,IAAA,aAAS,EAAC,WAAW,CAAC,EAAE,CAAC;YAC3B,MAAM,SAAS,GAAW,WAAW,CAAC,CAAC,QAAQ;QACjD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAG/C,MAAM,cAAc,GAAyB,GAAU,CAAC;QACxD,MAAM,UAAU,GAAW,cAAc,CAAC,CAAC,QAAQ;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
|
-
const __1 = require("..");
|
|
5
|
-
describe('isNotUndefined', () => {
|
|
6
|
-
it('should constrain type correctly', async () => {
|
|
7
|
-
const maybeNumber = undefined; // valid
|
|
8
|
-
if ((0, __1.isNotUndefined)(maybeNumber)) {
|
|
9
|
-
const defNumber = maybeNumber; // valid
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
describe('NotUndefined', () => {
|
|
14
|
-
it('should constrain type correctly', async () => {
|
|
15
|
-
const notMaybeNumber = 821;
|
|
16
|
-
const onlyNumber = notMaybeNumber; // valid
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=isNotUndefined.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isNotUndefined.test.js","sourceRoot":"","sources":["../../src/checks/isNotUndefined.test.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,0BAAkD;AAElD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAG/C,MAAM,WAAW,GAAgB,SAAgB,CAAC,CAAC,QAAQ;QAE3D,IAAI,IAAA,kBAAc,EAAC,WAAW,CAAC,EAAE,CAAC;YAChC,MAAM,SAAS,GAAW,WAAW,CAAC,CAAC,QAAQ;QACjD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;QAG/C,MAAM,cAAc,GAA8B,GAAU,CAAC;QAC7D,MAAM,UAAU,GAAW,cAAc,CAAC,CAAC,QAAQ;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const isOfEnum_1 = require("./isOfEnum");
|
|
4
|
-
describe('isOfEnum', () => {
|
|
5
|
-
let Planet;
|
|
6
|
-
(function (Planet) {
|
|
7
|
-
Planet["VENUS"] = "VENUS";
|
|
8
|
-
Planet["EARTH"] = "EARTH";
|
|
9
|
-
Planet["MARS"] = "MARS";
|
|
10
|
-
})(Planet || (Planet = {}));
|
|
11
|
-
it('can be used to assess correctly, default call', () => {
|
|
12
|
-
const isPlanet = (0, isOfEnum_1.createIsOfEnum)(Planet);
|
|
13
|
-
const earthIsPlanet = isPlanet('EARTH');
|
|
14
|
-
const plutoIsPlanet = isPlanet('PLUTO');
|
|
15
|
-
expect(earthIsPlanet).toEqual(true);
|
|
16
|
-
expect(plutoIsPlanet).toEqual(false);
|
|
17
|
-
});
|
|
18
|
-
it('can be used to assess correctly, named call', () => {
|
|
19
|
-
const isPlanet = (0, isOfEnum_1.createIsOfEnum)(Planet);
|
|
20
|
-
const earthIsPlanet = isPlanet.assess('EARTH');
|
|
21
|
-
const plutoIsPlanet = isPlanet.assess('PLUTO');
|
|
22
|
-
expect(earthIsPlanet).toEqual(true);
|
|
23
|
-
expect(plutoIsPlanet).toEqual(false);
|
|
24
|
-
});
|
|
25
|
-
it('can be used to create type guarded branches', () => {
|
|
26
|
-
const isPlanet = (0, isOfEnum_1.createIsOfEnum)(Planet);
|
|
27
|
-
const earth = 'EARTH';
|
|
28
|
-
if (isPlanet.assess(earth)) {
|
|
29
|
-
const home = earth; // no type error
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
it('can be used to create type asserted casts', () => {
|
|
33
|
-
const isPlanet = (0, isOfEnum_1.createIsOfEnum)(Planet);
|
|
34
|
-
const earth = 'EARTH';
|
|
35
|
-
const home = isPlanet.assure(earth);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=isOfEnum.test.js.map
|