type-fns 1.21.0 → 1.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/checks/hasMetadata.d.ts +1 -1
  2. package/dist/checks/hasMetadata.js +4 -1
  3. package/dist/checks/hasMetadata.js.map +1 -1
  4. package/dist/checks/isOfEnum.d.ts +1 -1
  5. package/dist/checks/isOfEnum.js.map +1 -1
  6. package/dist/checks/isPresent.assess.d.ts +2 -2
  7. package/dist/checks/isPresent.assess.js.map +1 -1
  8. package/dist/checks/isPresent.d.ts +2 -2
  9. package/dist/checks/isPresent.js +1 -3
  10. package/dist/checks/isPresent.js.map +1 -1
  11. package/dist/companions/omit.js.map +1 -1
  12. package/dist/companions/pick.js.map +1 -1
  13. package/dist/{domain → domain.objects}/constants.d.ts +1 -0
  14. package/dist/{domain → domain.objects}/constants.js +1 -0
  15. package/dist/domain.objects/constants.js.map +1 -0
  16. package/dist/guards/assure.d.ts +1 -1
  17. package/dist/guards/assure.js.map +1 -1
  18. package/dist/index.d.ts +11 -11
  19. package/dist/index.js +11 -11
  20. package/dist/index.js.map +1 -1
  21. package/dist/types/ArrayWith.d.ts +2 -1
  22. package/dist/types/ArrayWith.js +1 -0
  23. package/dist/wrappers/withAssure.js +1 -3
  24. package/dist/wrappers/withAssure.js.map +1 -1
  25. package/package.json +61 -40
  26. package/dist/checks/hasId.test.d.ts +0 -1
  27. package/dist/checks/hasId.test.js +0 -16
  28. package/dist/checks/hasId.test.js.map +0 -1
  29. package/dist/checks/hasMetadata.test.d.ts +0 -1
  30. package/dist/checks/hasMetadata.test.js +0 -29
  31. package/dist/checks/hasMetadata.test.js.map +0 -1
  32. package/dist/checks/hasUuid.test.d.ts +0 -1
  33. package/dist/checks/hasUuid.test.js +0 -16
  34. package/dist/checks/hasUuid.test.js.map +0 -1
  35. package/dist/checks/isAPromise.test.d.ts +0 -1
  36. package/dist/checks/isAPromise.test.js +0 -25
  37. package/dist/checks/isAPromise.test.js.map +0 -1
  38. package/dist/checks/isNotNull.test.d.ts +0 -1
  39. package/dist/checks/isNotNull.test.js +0 -19
  40. package/dist/checks/isNotNull.test.js.map +0 -1
  41. package/dist/checks/isNotUndefined.test.d.ts +0 -1
  42. package/dist/checks/isNotUndefined.test.js +0 -19
  43. package/dist/checks/isNotUndefined.test.js.map +0 -1
  44. package/dist/checks/isOfEnum.test.d.ts +0 -1
  45. package/dist/checks/isOfEnum.test.js +0 -38
  46. package/dist/checks/isOfEnum.test.js.map +0 -1
  47. package/dist/checks/isPresent.test.d.ts +0 -1
  48. package/dist/checks/isPresent.test.js +0 -78
  49. package/dist/checks/isPresent.test.js.map +0 -1
  50. package/dist/companions/omit.test.d.ts +0 -1
  51. package/dist/companions/omit.test.js +0 -11
  52. package/dist/companions/omit.test.js.map +0 -1
  53. package/dist/companions/pick.test.d.ts +0 -1
  54. package/dist/companions/pick.test.js +0 -11
  55. package/dist/companions/pick.test.js.map +0 -1
  56. package/dist/domain/constants.js.map +0 -1
  57. package/dist/guards/assure.test.d.ts +0 -1
  58. package/dist/guards/assure.test.js +0 -131
  59. package/dist/guards/assure.test.js.map +0 -1
  60. package/dist/types/ArrayWith.test.d.ts +0 -1
  61. package/dist/types/ArrayWith.test.js +0 -37
  62. package/dist/types/ArrayWith.test.js.map +0 -1
  63. package/dist/types/DropFirst.test.d.ts +0 -1
  64. package/dist/types/DropFirst.test.js +0 -12
  65. package/dist/types/DropFirst.test.js.map +0 -1
  66. package/dist/types/Literalize.test.d.ts +0 -1
  67. package/dist/types/Literalize.test.js +0 -18
  68. package/dist/types/Literalize.test.js.map +0 -1
  69. package/dist/types/PickAny.test.d.ts +0 -1
  70. package/dist/types/PickAny.test.js +0 -36
  71. package/dist/types/PickAny.test.js.map +0 -1
  72. package/dist/types/PickOne.test.d.ts +0 -1
  73. package/dist/types/PickOne.test.js +0 -35
  74. package/dist/types/PickOne.test.js.map +0 -1
  75. package/dist/wrappers/withAssure.test.d.ts +0 -1
  76. package/dist/wrappers/withAssure.test.js +0 -49
  77. package/dist/wrappers/withAssure.test.js.map +0 -1
  78. package/dist/wrappers/withNot.test.d.ts +0 -1
  79. package/dist/wrappers/withNot.test.js +0 -17
  80. 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
- const hasMetadata = (obj, keys = typicalMetadataKeys) => keys.every((key) => obj[key] !== undefined);
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;AA2DX;;;;;;;;;;;;GAYG;AACI,MAAM,WAAW,GAAG,CAIzB,GAAM,EACN,OAAuB,mBAA4C,EACvB,EAAE,CAC9C,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AAPjC,QAAA,WAAW,eAOsB"}
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,4 +1,4 @@
1
- import { AssessWithAssure } from '../wrappers/withAssure';
1
+ import { type AssessWithAssure } from '../wrappers/withAssure';
2
2
  /**
3
3
  * a generic fn that allows us to create type checks for enums. for example:
4
4
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"isOfEnum.js","sourceRoot":"","sources":["../../src/checks/isOfEnum.ts"],"names":[],"mappings":";;;AAAA,uDAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;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
+ {"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,2CAAiD;AACjD,qDAAwD;AAExD,MAAM,MAAM,GAAG,CAAI,CAAI,EAA8B,EAAE,CACrD,IAAA,qBAAS,EAAC,CAAC,CAAC,IAAI,IAAA,0BAAS,EAAC,CAAC,CAAC,CAAC;AAGZ,iCAAe"}
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 {
@@ -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 = function (...input) {
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,uDAAkD;AAGlD,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,UAC/C,GAAG,KAAgC;IAEnC,OAAO,IAAA,kCAAM,EAAC,GAAG,KAAK,CAAC,CAAC;AAC1B,CAGC,CAAC;AAI8B,wCAAS;AAHzC,mBAAmB,CAAC,MAAM,GAAG,kCAAM,CAAC;AACpC,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC"}
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,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IACnD,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,EAAE,EAAyB,CAAQ,CAAC;AAb1B,QAAA,IAAI,QAasB"}
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,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IACnD,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,EAAE,EAAyB,CAAQ,CAAC;AAb1B,QAAA,IAAI,QAasB"}
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"}
@@ -1,3 +1,4 @@
1
+ export {};
1
2
  /**
2
3
  * constants shared across the whole service but not tied to a specific domain object go in this file
3
4
  */
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  /**
3
4
  * constants shared across the whole service but not tied to a specific domain object go in this file
4
5
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/domain.objects/constants.ts"],"names":[],"mappings":";;AAAA;;GAEG"}
@@ -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,uDAGgC;AAEhC;;;;;;;;;;;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"}
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/isPresent';
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 './types/PickOne';
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 './types/DropFirst';
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/Empty';
21
- export * from './guards/assure';
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/isPresent"), exports);
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("./types/PickOne"), exports);
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("./types/DropFirst"), exports);
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/Empty"), exports);
37
- __exportStar(require("./guards/assure"), exports);
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,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,uDAAqC;AACrC,sDAAoC;AACpC,kDAAgC;AAChC,qDAAmC;AACnC,0DAAwC;AACxC,wDAAsC;AACtC,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC;AAClC,qDAAmC;AACnC,wDAAsC;AACtC,mDAAiC;AACjC,kDAAgC;AAChC,gDAA8B;AAC9B,kDAAgC"}
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 {};
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  //# sourceMappingURL=ArrayWith.js.map
@@ -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 = function (...input) {
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,UACb,GAAG,KAAgC;QAEnC,OAAO,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC;IAC1B,CAGC,CAAC;IACF,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB"}
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.0",
5
+ "version": "1.21.2",
6
6
  "repository": "ehmpathy/type-fns",
7
7
  "homepage": "https://github.com/ehmpathy/type-fns",
8
8
  "keywords": [
@@ -26,64 +26,85 @@
26
26
  ],
27
27
  "scripts": {
28
28
  "commit:with-cli": "npx cz",
29
- "fix:format:prettier": "prettier --write '**/*.ts' --config ./prettier.config.js",
30
- "fix:format": "npm run fix:format:prettier",
31
- "fix:lint": "eslint -c ./.eslintrc.js src/**/*.ts --fix",
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 dist/ -rf",
34
- "build:compile": "tsc -p ./tsconfig.build.json",
35
- "build": "npm run build:clean && npm run build:compile",
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.build.json --noEmit",
38
- "test:format:prettier": "prettier --parser typescript --check 'src/**/*.ts' --config ./prettier.config.js",
39
- "test:format": "npm run test:format:prettier",
40
- "test:lint:deps": "npx depcheck -c ./depcheckrc.yml",
41
- "test:lint:eslint": "eslint -c ./.eslintrc.js src/**/*.ts",
42
- "test:lint": "npm run test:lint:eslint && npm run test:lint:deps",
43
- "test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
44
- "test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
45
- "test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
46
- "test": "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",
47
- "test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
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
- "postinstall": "[ -d .git ] && npm run prepare:husky || exit 0",
53
- "prepare:husky": "npx husky install && chmod ug+x .husky/*"
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
- "helpful-errors": "^1.3.8"
64
+ "domain-objects": "0.31.10",
65
+ "helpful-errors": "^1.7.2"
57
66
  },
58
67
  "devDependencies": {
59
- "@commitlint/cli": "19.3.0",
60
- "@commitlint/config-conventional": "13.1.0",
61
- "@trivago/prettier-plugin-sort-imports": "4.3.0",
68
+ "@biomejs/biome": "2.3.8",
69
+ "@commitlint/cli": "19.5.0",
70
+ "@commitlint/config-conventional": "19.5.0",
71
+ "@jest/globals": "30.2.0",
72
+ "@swc/core": "1.15.3",
73
+ "@swc/jest": "0.2.39",
62
74
  "@tsconfig/node-lts-strictest": "18.12.1",
63
- "@types/jest": "29.2.4",
64
- "@typescript-eslint/eslint-plugin": "7.8.0",
65
- "@typescript-eslint/parser": "7.8.0",
75
+ "@tsconfig/node20": "20.1.5",
76
+ "@tsconfig/strictest": "2.0.5",
77
+ "@types/jest": "30.0.0",
78
+ "@types/node": "22.15.21",
66
79
  "core-js": "3.26.1",
67
- "cz-conventional-changelog": "3.0.1",
68
- "declapract": "0.12.3",
69
- "declapract-typescript-ehmpathy": "0.39.9",
80
+ "cz-conventional-changelog": "3.3.0",
81
+ "declapract": "0.13.18",
82
+ "declapract-typescript-ehmpathy": "0.47.58",
83
+ "declastruct": "1.7.3",
84
+ "declastruct-github": "1.3.5",
70
85
  "depcheck": "1.4.3",
71
- "eslint": "8.56.0",
72
- "eslint-config-airbnb-typescript": "18.0.0",
73
- "eslint-config-prettier": "8.5.0",
74
- "eslint-plugin-import": "2.26.0",
75
- "eslint-plugin-prettier": "4.2.1",
86
+ "dpdm": "4.0.1",
87
+ "esbuild-register": "3.6.0",
76
88
  "husky": "8.0.3",
77
- "jest": "29.3.1",
78
- "prettier": "2.8.1",
79
- "test-fns": "1.6.0",
89
+ "jest": "30.2.0",
90
+ "rhachet": "1.39.8",
91
+ "rhachet-brains-anthropic": "0.4.0",
92
+ "rhachet-brains-xai": "0.3.3",
93
+ "rhachet-roles-bhrain": "0.23.10",
94
+ "rhachet-roles-bhuild": "0.15.1",
95
+ "rhachet-roles-ehmpathy": "1.34.20",
96
+ "test-fns": "1.15.7",
80
97
  "ts-jest": "29.1.3",
81
98
  "ts-node": "10.9.2",
82
- "typescript": "5.4.5"
99
+ "tsc-alias": "1.8.10",
100
+ "tsx": "4.20.6",
101
+ "typescript": "5.4.5",
102
+ "yalc": "1.0.0-pre.53"
83
103
  },
84
104
  "config": {
85
105
  "commitizen": {
86
106
  "path": "./node_modules/cz-conventional-changelog"
87
107
  }
88
- }
108
+ },
109
+ "packageManager": "pnpm@10.24.0"
89
110
  }
@@ -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
@@ -1 +0,0 @@
1
- {"version":3,"file":"isOfEnum.test.js","sourceRoot":"","sources":["../../src/checks/isOfEnum.test.ts"],"names":[],"mappings":";;AAAA,yCAA4C;AAE5C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAK,MAIJ;IAJD,WAAK,MAAM;QACT,yBAAe,CAAA;QACf,yBAAe,CAAA;QACf,uBAAa,CAAA;IACf,CAAC,EAJI,MAAM,KAAN,MAAM,QAIV;IACD,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,QAAQ,GAAG,IAAA,yBAAc,EAAC,MAAM,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,QAAQ,GAAG,IAAA,yBAAc,EAAC,MAAM,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,QAAQ,GAAG,IAAA,yBAAc,EAAC,MAAM,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC;QACtB,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAW,KAAK,CAAC,CAAC,gBAAgB;QAC9C,CAAC;IACH,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,QAAQ,GAAG,IAAA,yBAAc,EAAC,MAAM,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG,OAAO,CAAC;QACtB,MAAM,IAAI,GAAW,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}