type-fns 0.6.0 → 0.8.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.
Files changed (82) hide show
  1. package/dist/checks/hasId.d.ts +1 -1
  2. package/dist/checks/hasId.js +2 -1
  3. package/dist/checks/hasId.js.map +1 -1
  4. package/dist/checks/hasId.test.d.ts +1 -0
  5. package/dist/checks/hasId.test.js +16 -0
  6. package/dist/checks/hasId.test.js.map +1 -0
  7. package/dist/checks/hasMetadata.d.ts +20 -3
  8. package/dist/checks/hasMetadata.js +25 -0
  9. package/dist/checks/hasMetadata.js.map +1 -1
  10. package/dist/checks/hasMetadata.test.d.ts +1 -0
  11. package/dist/checks/hasMetadata.test.js +18 -0
  12. package/dist/checks/hasMetadata.test.js.map +1 -0
  13. package/dist/checks/hasUuid.d.ts +1 -1
  14. package/dist/checks/hasUuid.js +2 -1
  15. package/dist/checks/hasUuid.js.map +1 -1
  16. package/dist/checks/hasUuid.test.d.ts +1 -0
  17. package/dist/checks/hasUuid.test.js +16 -0
  18. package/dist/checks/hasUuid.test.js.map +1 -0
  19. package/dist/checks/isAFunction.js +3 -1
  20. package/dist/checks/isAFunction.js.map +1 -1
  21. package/dist/checks/isAPromise.d.ts +1 -1
  22. package/dist/checks/isAPromise.js +2 -1
  23. package/dist/checks/isAPromise.js.map +1 -1
  24. package/dist/checks/isAPromise.test.d.ts +1 -0
  25. package/dist/checks/isAPromise.test.js +25 -0
  26. package/dist/checks/isAPromise.test.js.map +1 -0
  27. package/dist/checks/isNotNull.d.ts +1 -1
  28. package/dist/checks/isNotNull.js +2 -1
  29. package/dist/checks/isNotNull.js.map +1 -1
  30. package/dist/checks/isNotNull.test.d.ts +1 -0
  31. package/dist/checks/isNotNull.test.js +28 -0
  32. package/dist/checks/isNotNull.test.js.map +1 -0
  33. package/dist/checks/isNotUndefined.d.ts +1 -1
  34. package/dist/checks/isNotUndefined.js +2 -1
  35. package/dist/checks/isNotUndefined.js.map +1 -1
  36. package/dist/checks/isNotUndefined.test.d.ts +1 -0
  37. package/dist/checks/isNotUndefined.test.js +28 -0
  38. package/dist/checks/isNotUndefined.test.js.map +1 -0
  39. package/dist/checks/isOfEnum.d.ts +5 -6
  40. package/dist/checks/isOfEnum.js +2 -1
  41. package/dist/checks/isOfEnum.js.map +1 -1
  42. package/dist/checks/isOfEnum.test.d.ts +1 -0
  43. package/dist/checks/isOfEnum.test.js +19 -0
  44. package/dist/checks/isOfEnum.test.js.map +1 -0
  45. package/dist/checks/isPresent.js +2 -1
  46. package/dist/checks/isPresent.js.map +1 -1
  47. package/dist/checks/isPresent.test.d.ts +1 -0
  48. package/dist/checks/isPresent.test.js +25 -0
  49. package/dist/checks/isPresent.test.js.map +1 -0
  50. package/dist/deps.d.ts +1 -0
  51. package/dist/deps.js +6 -0
  52. package/dist/deps.js.map +1 -0
  53. package/dist/domain/constants.d.ts +3 -0
  54. package/dist/domain/constants.js +5 -0
  55. package/dist/domain/constants.js.map +1 -0
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +7 -2
  58. package/dist/index.js.map +1 -1
  59. package/dist/types/DropFirst.d.ts +10 -0
  60. package/dist/types/DropFirst.js +3 -0
  61. package/dist/types/DropFirst.js.map +1 -0
  62. package/dist/types/DropFirst.test.d.ts +1 -0
  63. package/dist/types/DropFirst.test.js +12 -0
  64. package/dist/types/DropFirst.test.js.map +1 -0
  65. package/dist/types/PickOne.d.ts +1 -1
  66. package/dist/types/PickOne.test.d.ts +1 -0
  67. package/dist/types/PickOne.test.js +38 -0
  68. package/dist/types/PickOne.test.js.map +1 -0
  69. package/dist/utils/environment.d.ts +7 -0
  70. package/dist/utils/environment.js +41 -0
  71. package/dist/utils/environment.js.map +1 -0
  72. package/dist/utils/errors/UnexpectedCodePathError.d.ts +9 -0
  73. package/dist/utils/errors/UnexpectedCodePathError.js +17 -0
  74. package/dist/utils/errors/UnexpectedCodePathError.js.map +1 -0
  75. package/dist/wrappers/withNot.js +2 -1
  76. package/dist/wrappers/withNot.js.map +1 -1
  77. package/dist/wrappers/withNot.test.d.ts +1 -0
  78. package/dist/wrappers/withNot.test.js +17 -0
  79. package/dist/wrappers/withNot.test.js.map +1 -0
  80. package/package.json +56 -34
  81. package/{README.md → readme.md} +14 -0
  82. package/changelog.md +0 -58
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * asserts that an object has an id
3
3
  */
4
- export declare type HasId<T> = T & {
4
+ export type HasId<T> = T & {
5
5
  id: number;
6
6
  };
7
7
  /**
@@ -4,7 +4,8 @@ exports.hasId = void 0;
4
4
  /**
5
5
  * checks whether not an object that may have an id does have the id, at runtime
6
6
  */
7
- exports.hasId = (obj) => {
7
+ const hasId = (obj) => {
8
8
  return !!obj.id;
9
9
  };
10
+ exports.hasId = hasId;
10
11
  //# sourceMappingURL=hasId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasId.js","sourceRoot":"","sources":["../../src/checks/hasId.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACU,QAAA,KAAK,GAAG,CAAwC,GAAM,EAAmB,EAAE;IACtF,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAClB,CAAC,CAAC"}
1
+ {"version":3,"file":"hasId.js","sourceRoot":"","sources":["../../src/checks/hasId.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACI,MAAM,KAAK,GAAG,CACnB,GAAM,EACW,EAAE;IACnB,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAClB,CAAC,CAAC;AAJW,QAAA,KAAK,SAIhB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
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,7 +1,11 @@
1
1
  /**
2
2
  * these are the keys most commonly used metadata keys
3
3
  */
4
- declare type TypicalMetadataKeys = 'id' | 'uuid' | 'createdAt' | 'updatedAt' | 'effectiveAt';
4
+ declare const typicalMetadataKeys: readonly ["id", "uuid", "createdAt", "updatedAt", "effectiveAt"];
5
+ /**
6
+ * these are the keys most commonly used metadata keys
7
+ */
8
+ type TypicalMetadataKeys = typeof typicalMetadataKeys[number];
5
9
  /**
6
10
  * asserts that any optional metadata keys of the object will now be required
7
11
  *
@@ -15,9 +19,22 @@ declare type TypicalMetadataKeys = 'id' | 'uuid' | 'createdAt' | 'updatedAt' | '
15
19
  * note:
16
20
  * - this type does not make any other optional, non-metadata keys required
17
21
  * - i.e., any optional types on the object that are not specified as metadata keys will not be made required
18
- * - this type does not _add_ any database-generated properties to the type definition
22
+ * - this type does not _add_ any metadata properties to the type definition
19
23
  * - i.e., if a metadata key was not already present on the object's type - it will not be added
20
24
  */
21
- export declare type HasMetadata<T extends Record<string, any>, MetadataKeys = TypicalMetadataKeys> = T & Required<Pick<T, keyof T & // that are on the object
25
+ export type HasMetadata<T extends Record<string, any>, MetadataKeys = TypicalMetadataKeys> = T & Required<Pick<T, keyof T & // that are on the object
22
26
  MetadataKeys>>;
27
+ /**
28
+ * for an object of type T, asserts that the object HasMetadata<T, K> for all listed metadata keys K
29
+ *
30
+ * by default, the following keys are considered to be metadata:
31
+ * - `id`
32
+ * - `uuid`
33
+ * - `createdAt`
34
+ * - `updatedAt`
35
+ * - `effectiveAt`
36
+ *
37
+ * see more information about the `HasMetadata` type in its jsdoc on-hover documentation
38
+ */
39
+ export declare const hasMetadata: <MetadataKeys extends string = "id" | "uuid" | "createdAt" | "updatedAt" | "effectiveAt", T extends Record<string, any> = Record<string, any>>(obj: T, keys?: MetadataKeys[]) => obj is HasMetadata<T, MetadataKeys>;
23
40
  export {};
@@ -1,3 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasMetadata = void 0;
4
+ /**
5
+ * these are the keys most commonly used metadata keys
6
+ */
7
+ const typicalMetadataKeys = [
8
+ 'id',
9
+ 'uuid',
10
+ 'createdAt',
11
+ 'updatedAt',
12
+ 'effectiveAt',
13
+ ];
14
+ /**
15
+ * for an object of type T, asserts that the object HasMetadata<T, K> for all listed metadata keys K
16
+ *
17
+ * by default, the following keys are considered to be metadata:
18
+ * - `id`
19
+ * - `uuid`
20
+ * - `createdAt`
21
+ * - `updatedAt`
22
+ * - `effectiveAt`
23
+ *
24
+ * see more information about the `HasMetadata` type in its jsdoc on-hover documentation
25
+ */
26
+ const hasMetadata = (obj, keys = typicalMetadataKeys) => keys.every((key) => obj[key] !== undefined);
27
+ exports.hasMetadata = hasMetadata;
3
28
  //# sourceMappingURL=hasMetadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasMetadata.js","sourceRoot":"","sources":["../../src/checks/hasMetadata.ts"],"names":[],"mappings":""}
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,aAAa;CACL,CAAC;AAmCX;;;;;;;;;;;GAWG;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"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
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('hasMetadata', () => {
11
+ it('should enable accessing an optional metadata property of a type', () => {
12
+ const pot = { id: 123, age: 72 };
13
+ if (!(0, __1.hasMetadata)(pot, ['id']))
14
+ throw new Error('doesnt have metadata');
15
+ expect(pot.id.toFixed).toBeDefined();
16
+ });
17
+ });
18
+ //# sourceMappingURL=hasMetadata.test.js.map
@@ -0,0 +1 @@
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,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,7 +1,7 @@
1
1
  /**
2
2
  * asserts that an object has a uuid
3
3
  */
4
- export declare type HasUuid<T> = T & {
4
+ export type HasUuid<T> = T & {
5
5
  uuid: string;
6
6
  };
7
7
  /**
@@ -4,7 +4,8 @@ exports.hasUuid = void 0;
4
4
  /**
5
5
  * checks whether not an object that may have a uuid does have the uuid, at runtime
6
6
  */
7
- exports.hasUuid = (obj) => {
7
+ const hasUuid = (obj) => {
8
8
  return typeof obj.uuid === 'string';
9
9
  };
10
+ exports.hasUuid = hasUuid;
10
11
  //# sourceMappingURL=hasUuid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasUuid.js","sourceRoot":"","sources":["../../src/checks/hasUuid.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACU,QAAA,OAAO,GAAG,CAA0C,GAAM,EAAqB,EAAE;IAC5F,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC;AACtC,CAAC,CAAC"}
1
+ {"version":3,"file":"hasUuid.js","sourceRoot":"","sources":["../../src/checks/hasUuid.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACI,MAAM,OAAO,GAAG,CACrB,GAAM,EACa,EAAE;IACrB,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC;AACtC,CAAC,CAAC;AAJW,QAAA,OAAO,WAIlB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
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,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAFunction = void 0;
4
- exports.isAFunction = (obj) => typeof obj === 'function';
4
+ // eslint-disable-next-line @typescript-eslint/ban-types
5
+ const isAFunction = (obj) => typeof obj === 'function';
6
+ exports.isAFunction = isAFunction;
5
7
  //# sourceMappingURL=isAFunction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isAFunction.js","sourceRoot":"","sources":["../../src/checks/isAFunction.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,CAAC,GAAQ,EAAmB,EAAE,CAAC,OAAO,GAAG,KAAK,UAAU,CAAC"}
1
+ {"version":3,"file":"isAFunction.js","sourceRoot":"","sources":["../../src/checks/isAFunction.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACjD,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAmB,EAAE,CACvD,OAAO,GAAG,KAAK,UAAU,CAAC;AADf,QAAA,WAAW,eACI"}
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * checks whether the value is a promise
3
3
  */
4
- export declare const isAPromise: <T extends unknown = any>(obj: any) => obj is Promise<T>;
4
+ export declare const isAPromise: <T = any>(obj: any) => obj is Promise<T>;
@@ -4,5 +4,6 @@ exports.isAPromise = void 0;
4
4
  /**
5
5
  * checks whether the value is a promise
6
6
  */
7
- exports.isAPromise = (obj) => Promise.resolve(obj) === obj;
7
+ const isAPromise = (obj) => Promise.resolve(obj) === obj;
8
+ exports.isAPromise = isAPromise;
8
9
  //# sourceMappingURL=isAPromise.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isAPromise.js","sourceRoot":"","sources":["../../src/checks/isAPromise.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,UAAU,GAAG,CAAsB,GAAQ,EAAqB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC"}
1
+ {"version":3,"file":"isAPromise.js","sourceRoot":"","sources":["../../src/checks/isAPromise.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,UAAU,GAAG,CAAU,GAAQ,EAAqB,EAAE,CACjE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;AADlB,QAAA,UAAU,cACQ"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
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
@@ -0,0 +1 @@
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;YAC7B,KAAK,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;SACvC;aAAM;YACL,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * ref
5
5
  * - https://stackoverflow.com/a/63045455/3068233
6
6
  */
7
- export declare type NotNull<T> = T extends null ? never : T;
7
+ export type NotNull<T> = T extends null ? never : T;
8
8
  /**
9
9
  * checks whether the value is not undefined
10
10
  */
@@ -4,5 +4,6 @@ exports.isNotNull = void 0;
4
4
  /**
5
5
  * checks whether the value is not undefined
6
6
  */
7
- exports.isNotNull = (val) => val !== null;
7
+ const isNotNull = (val) => val !== null;
8
+ exports.isNotNull = isNotNull;
8
9
  //# sourceMappingURL=isNotNull.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isNotNull.js","sourceRoot":"","sources":["../../src/checks/isNotNull.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACU,QAAA,SAAS,GAAG,CAAI,GAAM,EAAqB,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"isNotNull.js","sourceRoot":"","sources":["../../src/checks/isNotNull.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACI,MAAM,SAAS,GAAG,CAAI,GAAM,EAAqB,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC;AAA3D,QAAA,SAAS,aAAkD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /* eslint-disable @typescript-eslint/no-unused-vars */
13
+ const __1 = require("..");
14
+ describe('isNotNull', () => {
15
+ it('should constrain type correctly', () => __awaiter(void 0, void 0, void 0, function* () {
16
+ const maybeNumber = undefined; // valid
17
+ if ((0, __1.isNotNull)(maybeNumber)) {
18
+ const defNumber = maybeNumber; // valid
19
+ }
20
+ }));
21
+ });
22
+ describe('NotNull', () => {
23
+ it('should constrain type correctly', () => __awaiter(void 0, void 0, void 0, function* () {
24
+ const notMaybeNumber = 821;
25
+ const onlyNumber = notMaybeNumber; // valid
26
+ }));
27
+ });
28
+ //# sourceMappingURL=isNotNull.test.js.map
@@ -0,0 +1 @@
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,GAAS,EAAE;QAG/C,MAAM,WAAW,GAAgB,SAAgB,CAAC,CAAC,QAAQ;QAE3D,IAAI,IAAA,aAAS,EAAC,WAAW,CAAC,EAAE;YAC1B,MAAM,SAAS,GAAW,WAAW,CAAC,CAAC,QAAQ;SAChD;IACH,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,iCAAiC,EAAE,GAAS,EAAE;QAG/C,MAAM,cAAc,GAAyB,GAAU,CAAC;QACxD,MAAM,UAAU,GAAW,cAAc,CAAC,CAAC,QAAQ;IACrD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * ref
5
5
  * - https://stackoverflow.com/a/63045455/3068233
6
6
  */
7
- export declare type NotUndefined<T> = T extends undefined ? never : T;
7
+ export type NotUndefined<T> = T extends undefined ? never : T;
8
8
  /**
9
9
  * checks whether the value is not undefined
10
10
  */
@@ -4,5 +4,6 @@ exports.isNotUndefined = void 0;
4
4
  /**
5
5
  * checks whether the value is not undefined
6
6
  */
7
- exports.isNotUndefined = (val) => typeof val !== 'undefined';
7
+ const isNotUndefined = (val) => typeof val !== 'undefined';
8
+ exports.isNotUndefined = isNotUndefined;
8
9
  //# sourceMappingURL=isNotUndefined.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isNotUndefined.js","sourceRoot":"","sources":["../../src/checks/isNotUndefined.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACU,QAAA,cAAc,GAAG,CAAI,GAAM,EAA0B,EAAE,CAAC,OAAO,GAAG,KAAK,WAAW,CAAC"}
1
+ {"version":3,"file":"isNotUndefined.js","sourceRoot":"","sources":["../../src/checks/isNotUndefined.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACI,MAAM,cAAc,GAAG,CAAI,GAAM,EAA0B,EAAE,CAClE,OAAO,GAAG,KAAK,WAAW,CAAC;AADhB,QAAA,cAAc,kBACE"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /* eslint-disable @typescript-eslint/no-unused-vars */
13
+ const __1 = require("..");
14
+ describe('isNotUndefined', () => {
15
+ it('should constrain type correctly', () => __awaiter(void 0, void 0, void 0, function* () {
16
+ const maybeNumber = undefined; // valid
17
+ if ((0, __1.isNotUndefined)(maybeNumber)) {
18
+ const defNumber = maybeNumber; // valid
19
+ }
20
+ }));
21
+ });
22
+ describe('NotUndefined', () => {
23
+ it('should constrain type correctly', () => __awaiter(void 0, void 0, void 0, function* () {
24
+ const notMaybeNumber = 821;
25
+ const onlyNumber = notMaybeNumber; // valid
26
+ }));
27
+ });
28
+ //# sourceMappingURL=isNotUndefined.test.js.map
@@ -0,0 +1 @@
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,GAAS,EAAE;QAG/C,MAAM,WAAW,GAAgB,SAAgB,CAAC,CAAC,QAAQ;QAE3D,IAAI,IAAA,kBAAc,EAAC,WAAW,CAAC,EAAE;YAC/B,MAAM,SAAS,GAAW,WAAW,CAAC,CAAC,QAAQ;SAChD;IACH,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,iCAAiC,EAAE,GAAS,EAAE;QAG/C,MAAM,cAAc,GAA8B,GAAU,CAAC;QAC7D,MAAM,UAAU,GAAW,cAAc,CAAC,CAAC,QAAQ;IACrD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,7 +1,3 @@
1
- /**
2
- * `Something` = `any`, with the exclusion of `null` and `undefined`
3
- */
4
- declare type Something = {};
5
1
  /**
6
2
  * a generic fn that allows us to create type checks for enums. for example:
7
3
  * ```ts
@@ -23,5 +19,8 @@ declare type Something = {};
23
19
  *
24
20
  * ref: https://stackoverflow.com/a/58278753/3068233
25
21
  */
26
- export declare const createIsOfEnum: <T>(e: T) => (token: Something) => token is T[keyof T];
27
- export {};
22
+ export declare const createIsOfEnum: <T extends {
23
+ [index: string]: string | number;
24
+ [index: number]: string | number;
25
+ [index: symbol]: string | number;
26
+ }>(e: T) => (token: string | number | symbol) => token is T[keyof T];
@@ -22,5 +22,6 @@ exports.createIsOfEnum = void 0;
22
22
  *
23
23
  * ref: https://stackoverflow.com/a/58278753/3068233
24
24
  */
25
- exports.createIsOfEnum = (e) => (token) => Object.values(e).includes(token);
25
+ const createIsOfEnum = (e) => (token) => Object.values(e).includes(token);
26
+ exports.createIsOfEnum = createIsOfEnum;
26
27
  //# sourceMappingURL=isOfEnum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isOfEnum.js","sourceRoot":"","sources":["../../src/checks/isOfEnum.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;;;;GAoBG;AACU,QAAA,cAAc,GAAG,CAAI,CAAI,EAAE,EAAE,CAAC,CAAC,KAAgB,EAAuB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAmB,CAAC,CAAC"}
1
+ {"version":3,"file":"isOfEnum.js","sourceRoot":"","sources":["../../src/checks/isOfEnum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,cAAc,GACzB,CAAmE,CAAI,EAAE,EAAE,CAC3E,CAAC,KAA+B,EAAuB,EAAE,CACvD,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAmB,CAAC,CAAC;AAHtC,QAAA,cAAc,kBAGwB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const isOfEnum_1 = require("./isOfEnum");
4
+ describe('isOfEnum', () => {
5
+ it('can be used for custom enums correctly', () => {
6
+ let Planet;
7
+ (function (Planet) {
8
+ Planet["VENUS"] = "VENUS";
9
+ Planet["EARTH"] = "EARTH";
10
+ Planet["MARS"] = "MARS";
11
+ })(Planet || (Planet = {}));
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
+ });
19
+ //# sourceMappingURL=isOfEnum.test.js.map
@@ -0,0 +1 @@
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,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,IAAK,MAIJ;QAJD,WAAK,MAAM;YACT,yBAAe,CAAA;YACf,yBAAe,CAAA;YACf,uBAAa,CAAA;QACf,CAAC,EAJI,MAAM,KAAN,MAAM,QAIV;QACD,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;AACL,CAAC,CAAC,CAAC"}
@@ -6,5 +6,6 @@ exports.isPresent = void 0;
6
6
  *
7
7
  * https://github.com/microsoft/TypeScript/issues/16069#issuecomment-566222173
8
8
  */
9
- exports.isPresent = (t) => t !== undefined && t !== null;
9
+ const isPresent = (t) => t !== undefined && t !== null;
10
+ exports.isPresent = isPresent;
10
11
  //# sourceMappingURL=isPresent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/checks/isPresent.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,SAAS,GAAG,CAAI,CAA8B,EAAU,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"isPresent.js","sourceRoot":"","sources":["../../src/checks/isPresent.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,SAAS,GAAG,CAAI,CAA8B,EAAU,EAAE,CACrE,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC;AADnB,QAAA,SAAS,aACU"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const isPresent_1 = require("./isPresent");
4
+ describe('isPresent', () => {
5
+ it('should return false if is null', () => {
6
+ expect((0, isPresent_1.isPresent)(null)).toEqual(false);
7
+ });
8
+ it('should return false if is undefined', () => {
9
+ expect((0, isPresent_1.isPresent)(null)).toEqual(false);
10
+ });
11
+ it('should return true if is falsy', () => {
12
+ expect((0, isPresent_1.isPresent)(false)).toEqual(true);
13
+ expect((0, isPresent_1.isPresent)(0)).toEqual(true);
14
+ expect((0, isPresent_1.isPresent)('')).toEqual(true);
15
+ });
16
+ it('should be useful in having correct types after filtering', () => {
17
+ const stringsOrNulls = ['hello', '', null, 'world', undefined]; // type = `(string | null | undefined)[]`
18
+ const strings = stringsOrNulls.filter(isPresent_1.isPresent); // type = string[]
19
+ // check that it did what we expected in runtime
20
+ expect(strings).toEqual(['hello', '', 'world']);
21
+ // check that it successfully informed typescript of this too
22
+ strings.map((string) => string.toUpperCase()); // This should not throw a type error, because the filter should have told typescript it took out the nulls
23
+ });
24
+ });
25
+ //# sourceMappingURL=isPresent.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPresent.test.js","sourceRoot":"","sources":["../../src/checks/isPresent.test.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AAExC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,IAAA,qBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,CAAC,IAAA,qBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,IAAA,qBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,IAAA,qBAAS,EAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,IAAA,qBAAS,EAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,yCAAyC;QACzG,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,qBAAS,CAAC,CAAC,CAAC,kBAAkB;QAEpE,gDAAgD;QAChD,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;QAEhD,6DAA6D;QAC7D,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,2GAA2G;IAC5J,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/dist/deps.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { v4 as uuid } from 'uuid';
package/dist/deps.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uuid = void 0;
4
+ var uuid_1 = require("uuid");
5
+ Object.defineProperty(exports, "uuid", { enumerable: true, get: function () { return uuid_1.v4; } });
6
+ //# sourceMappingURL=deps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deps.js","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":";;;AAAA,6BAAkC;AAAzB,4FAAA,EAAE,OAAQ"}
@@ -0,0 +1,3 @@
1
+ /**
2
+ * constants shared across the whole service but not tied to a specific domain object go in this file
3
+ */
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * constants shared across the whole service but not tied to a specific domain object go in this file
4
+ */
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/domain/constants.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/dist/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export * from './checks/isAPromise';
9
9
  export * from './types/PickOne';
10
10
  export * from './checks/isNotNull';
11
11
  export * from './checks/isNotUndefined';
12
+ export * from './types/DropFirst';
package/dist/index.js CHANGED
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./checks/hasId"), exports);
@@ -21,4 +25,5 @@ __exportStar(require("./checks/isAPromise"), exports);
21
25
  __exportStar(require("./types/PickOne"), exports);
22
26
  __exportStar(require("./checks/isNotNull"), exports);
23
27
  __exportStar(require("./checks/isNotUndefined"), exports);
28
+ __exportStar(require("./types/DropFirst"), exports);
24
29
  //# 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"}
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,oDAAkC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * drop the first type in an array
3
+ *
4
+ * example use cases
5
+ * - reference all parameters except first in typescript
6
+ *
7
+ * ref
8
+ * - https://stackoverflow.com/questions/63024617/how-to-reference-all-parameters-except-first-in-typescript
9
+ */
10
+ export type DropFirst<T extends unknown[]> = T extends [any, ...infer U] ? U : never;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=DropFirst.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropFirst.js","sourceRoot":"","sources":["../../src/types/DropFirst.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable @typescript-eslint/no-unused-vars */
4
+ describe('DropFirst', () => {
5
+ it('should be drop the first type in an array', () => {
6
+ const numStrStr = [1, '2', '3'];
7
+ const strStr = ['1', '2'];
8
+ const str = strStr[0];
9
+ const num = numStrStr[0];
10
+ });
11
+ });
12
+ //# sourceMappingURL=DropFirst.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropFirst.test.js","sourceRoot":"","sources":["../../src/types/DropFirst.test.ts"],"names":[],"mappings":";;AAEA,sDAAsD;AACtD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QAEnD,MAAM,SAAS,GAAuB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QACpD,MAAM,MAAM,GAAkC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACzD,MAAM,GAAG,GAAW,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,GAAG,GAAW,SAAS,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -4,6 +4,6 @@
4
4
  * ref:
5
5
  * - https://stackoverflow.com/a/56933182/3068233
6
6
  */
7
- export declare type PickOne<T> = {
7
+ export type PickOne<T> = {
8
8
  [P in keyof T]: Record<P, T[P]> & Partial<Record<Exclude<keyof T, P>, undefined>>;
9
9
  }[keyof T];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ describe('PickOne', () => {
13
+ it('should constrain type correctly', () => __awaiter(void 0, void 0, void 0, function* () {
14
+ const findWrench = ({}) => __awaiter(void 0, void 0, void 0, function* () {
15
+ // ...
16
+ });
17
+ // you can find by metric
18
+ yield findWrench({
19
+ size: {
20
+ metric: { millimeters: 16 },
21
+ },
22
+ });
23
+ // you can find by imperial
24
+ yield findWrench({
25
+ size: {
26
+ imperial: { inches: '5/16' },
27
+ },
28
+ });
29
+ // you can't find by both
30
+ // await findWrench({
31
+ // size: {
32
+ // metric: { millimeters: 16 },
33
+ // imperial: { inches: '5/16' },
34
+ // },
35
+ // });
36
+ }));
37
+ });
38
+ //# sourceMappingURL=PickOne.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PickOne.test.js","sourceRoot":"","sources":["../../src/types/PickOne.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,iCAAiC,EAAE,GAAS,EAAE;QAC/C,MAAM,UAAU,GAAG,CAAO,EAezB,EAAE,EAAE;YACH,MAAM;QACR,CAAC,CAAA,CAAC;QAEF,yBAAyB;QACzB,MAAM,UAAU,CAAC;YACf,IAAI,EAAE;gBACJ,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;aAC5B;SACF,CAAC,CAAC;QAEH,2BAA2B;QAC3B,MAAM,UAAU,CAAC;YACf,IAAI,EAAE;gBACJ,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;aAC7B;SACF,CAAC,CAAC;QAEH,yBAAyB;QACzB,qBAAqB;QACrB,YAAY;QACZ,mCAAmC;QACnC,oCAAoC;QACpC,OAAO;QACP,MAAM;IACR,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare enum Stage {
2
+ PRODUCTION = "prod",
3
+ DEVELOPMENT = "dev",
4
+ TEST = "test"
5
+ }
6
+ export declare const stage: string;
7
+ export declare const serviceClientStage: Stage;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serviceClientStage = exports.stage = exports.Stage = void 0;
4
+ var Stage;
5
+ (function (Stage) {
6
+ Stage["PRODUCTION"] = "prod";
7
+ Stage["DEVELOPMENT"] = "dev";
8
+ Stage["TEST"] = "test";
9
+ })(Stage = exports.Stage || (exports.Stage = {}));
10
+ /**
11
+ * this allows us to infer what the stage should be in environments that do not have STAGE specified
12
+ * - e.g., when running locally
13
+ * - e.g., when running tests
14
+ */
15
+ const inferStageFromNodeEnv = () => {
16
+ const nodeEnv = process.env.NODE_ENV; // default to test if not defined
17
+ if (!nodeEnv)
18
+ throw new Error('process.env.NODE_ENV must be defined');
19
+ if (nodeEnv === 'production')
20
+ return Stage.PRODUCTION;
21
+ if (nodeEnv === 'development')
22
+ return Stage.DEVELOPMENT;
23
+ if (nodeEnv === 'test')
24
+ return Stage.TEST;
25
+ throw new Error(`unexpected nodeEnv '${nodeEnv}'`);
26
+ };
27
+ /**
28
+ * a method that exposes relevant environmental variables in a standard way
29
+ */
30
+ const getEnvironment = () => {
31
+ var _a;
32
+ const stage = (_a = process.env.STAGE) !== null && _a !== void 0 ? _a : inferStageFromNodeEnv(); // figure it out from NODE_ENV if not explicitly defined
33
+ if (!stage)
34
+ throw new Error('process.env.STAGE must be defined');
35
+ return { stage };
36
+ };
37
+ // export stage immediately, since it does not change
38
+ exports.stage = getEnvironment().stage;
39
+ // export service client stage
40
+ exports.serviceClientStage = exports.stage === Stage.PRODUCTION ? Stage.PRODUCTION : Stage.DEVELOPMENT; // i.e., if its prod, hit prod. otherwise, dev
41
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/utils/environment.ts"],"names":[],"mappings":";;;AAAA,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,4BAAmB,CAAA;IACnB,4BAAmB,CAAA;IACnB,sBAAa,CAAA;AACf,CAAC,EAJW,KAAK,GAAL,aAAK,KAAL,aAAK,QAIhB;AAED;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,iCAAiC;IACvE,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtE,IAAI,OAAO,KAAK,YAAY;QAAE,OAAO,KAAK,CAAC,UAAU,CAAC;IACtD,IAAI,OAAO,KAAK,aAAa;QAAE,OAAO,KAAK,CAAC,WAAW,CAAC;IACxD,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAC1C,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,GAAG,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAAG,GAAG,EAAE;;IAC1B,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,KAAK,mCAAI,qBAAqB,EAAE,CAAC,CAAC,wDAAwD;IACpH,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACjE,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC,CAAC;AAEF,qDAAqD;AACtC,aAAK,GAAK,cAAc,EAAE,OAAC;AAE1C,8BAA8B;AACjB,QAAA,kBAAkB,GAC7B,aAAK,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,8CAA8C"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * UnexpectedCodePath errors are used to indicate that we've reached a code path that should never have been reached
3
+ *
4
+ * Purpose of having a dedicated class for this type of error is to allow us to easily add metadata about what was going on when we reached this code path
5
+ * - e.g., the variables in memory at the time
6
+ */
7
+ export declare class UnexpectedCodePathError extends Error {
8
+ constructor(message: string, metadata?: Record<string, any>);
9
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnexpectedCodePathError = void 0;
4
+ /**
5
+ * UnexpectedCodePath errors are used to indicate that we've reached a code path that should never have been reached
6
+ *
7
+ * Purpose of having a dedicated class for this type of error is to allow us to easily add metadata about what was going on when we reached this code path
8
+ * - e.g., the variables in memory at the time
9
+ */
10
+ class UnexpectedCodePathError extends Error {
11
+ constructor(message, metadata) {
12
+ const fullMessage = `UnexpectedCodePath: ${message}${metadata ? `\n\n${JSON.stringify(metadata)}` : ''}}`;
13
+ super(fullMessage);
14
+ }
15
+ }
16
+ exports.UnexpectedCodePathError = UnexpectedCodePathError;
17
+ //# sourceMappingURL=UnexpectedCodePathError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnexpectedCodePathError.js","sourceRoot":"","sources":["../../../src/utils/errors/UnexpectedCodePathError.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAChD,YAAY,OAAe,EAAE,QAA8B;QACzD,MAAM,WAAW,GAAG,uBAAuB,OAAO,GAChD,QAAQ,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EACjD,GAAG,CAAC;QACJ,KAAK,CAAC,WAAW,CAAC,CAAC;IACrB,CAAC;CACF;AAPD,0DAOC"}
@@ -11,5 +11,6 @@ exports.withNot = void 0;
11
11
  * const invalidOptions = objects.filter(withNot(isOfStatus));
12
12
  * ```
13
13
  */
14
- exports.withNot = (is) => (args) => !is(args);
14
+ const withNot = (is) => (args) => !is(args);
15
+ exports.withNot = withNot;
15
16
  //# sourceMappingURL=withNot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"withNot.js","sourceRoot":"","sources":["../../src/wrappers/withNot.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACU,QAAA,OAAO,GAAG,CAAI,EAAwB,EAA0B,EAAE,CAAC,CAAC,IAAO,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"withNot.js","sourceRoot":"","sources":["../../src/wrappers/withNot.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACI,MAAM,OAAO,GAClB,CAAI,EAAwB,EAA0B,EAAE,CACxD,CAAC,IAAO,EAAE,EAAE,CACV,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAHD,QAAA,OAAO,WAGN"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const hasId_1 = require("../checks/hasId");
4
+ const withNot_1 = require("./withNot");
5
+ describe('withNot', () => {
6
+ it('should return false if an object has an id after wrapping hasId', () => {
7
+ const obj = { id: 821, name: 'bob' };
8
+ const itDoesNotHaveId = (0, withNot_1.withNot)(hasId_1.hasId)(obj);
9
+ expect(itDoesNotHaveId).toEqual(false);
10
+ });
11
+ it('should return false if an object does not have an id', () => {
12
+ const obj = { name: 'bob' };
13
+ const itDoesNotHaveId = (0, withNot_1.withNot)(hasId_1.hasId)(obj);
14
+ expect(itDoesNotHaveId).toEqual(true);
15
+ });
16
+ });
17
+ //# sourceMappingURL=withNot.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withNot.test.js","sourceRoot":"","sources":["../../src/wrappers/withNot.test.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AACxC,uCAAoC;AAEpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,GAAG,GAAkC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACpE,MAAM,eAAe,GAAG,IAAA,iBAAO,EAAC,aAAK,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,GAAG,GAAkC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC3D,MAAM,eAAe,GAAG,IAAA,iBAAO,EAAC,aAAK,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "type-fns",
3
- "version": "0.6.0",
3
+ "author": "ehmpathy",
4
4
  "description": "A set of types, type checks, and type guards for simpler, safer, and easier to read code.",
5
- "author": "UladKasach @uladkasach",
6
- "license": "MIT",
5
+ "version": "0.8.1",
7
6
  "repository": "ehmpathy/type-fns",
8
7
  "homepage": "https://github.com/ehmpathy/type-fns",
9
8
  "keywords": [
@@ -25,40 +24,63 @@
25
24
  "/dist"
26
25
  ],
27
26
  "scripts": {
28
- "build:clean": "rm -rf ./dist",
29
- "build:ts": "tsc -p ./tsconfig.build.json",
30
- "build": "npm run build:clean && npm run build:ts",
31
- "test:types": "tsc --noEmit",
32
- "test:format": "prettier --parser typescript --check 'src/**/*.ts' --config ./prettier.config.js",
33
- "test:lint": "eslint -c ./.eslintrc.js src/**/*.ts",
34
- "test:unit": "jest --forceExit --verbose --passWithNoTests",
35
- "test:integration": "jest -c ./jest.integration.config.js --forceExit --verbose --passWithNoTests",
36
- "test": "npm run test:types && npm run test:lint && npm run test:unit && npm run test:integration",
27
+ "commit:with-cli": "npx cz",
28
+ "fix:format:terraform": "echo 'no terraform'",
29
+ "fix:format:prettier": "prettier --write '**/*.ts' --config ./prettier.config.js",
30
+ "fix:format": "npm run fix:format:prettier && npm run fix:format:terraform",
31
+ "fix:lint": "eslint -c ./.eslintrc.js src/**/*.ts --fix",
32
+ "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 && npm run build:artifact",
36
+ "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",
37
38
  "prepublish": "npm run build",
38
- "preversion": "npm run prepublish && npm run test",
39
+ "test:lint:deps": "npx depcheck -c ./depcheckrc.yml",
40
+ "test:format:terraform": "echo 'no terraform'",
41
+ "test:format:prettier": "prettier --parser typescript --check 'src/**/*.ts' --config ./prettier.config.js",
42
+ "test:format": "npm run test:format:prettier && npm run test:format:terraform",
43
+ "test:lint": "npm run test:lint:eslint && npm run test:lint:deps",
44
+ "test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests",
45
+ "test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests",
46
+ "test:lint:eslint": "eslint -c ./.eslintrc.js src/**/*.ts",
47
+ "test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
48
+ "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",
49
+ "test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
50
+ "prepush": "npm run test && npm run build",
51
+ "preversion": "npm run prepush",
39
52
  "postversion": "git push origin HEAD --tags --no-verify"
40
53
  },
41
54
  "devDependencies": {
42
- "@types/jest": "^24.0.18",
43
- "@types/lodash.pick": "^4.4.6",
44
- "@types/uuid": "^3.4.5",
45
- "@typescript-eslint/eslint-plugin": "2.19.0",
46
- "@typescript-eslint/parser": "2.19.0",
47
- "dotenv": "^8.1.0",
48
- "eslint": "6.1.0",
49
- "eslint-config-airbnb-base": "14.0.0",
50
- "eslint-config-airbnb-typescript": "7.0.0",
51
- "eslint-config-prettier": "6.10.0",
52
- "eslint-plugin-import": "2.20.1",
53
- "eslint-plugin-prettier": "3.1.2",
54
- "husky": "^1.3.1",
55
- "jest": "^25.5.4",
56
- "joi": "^17.2.1",
57
- "prettier": "^2.0.4",
58
- "ts-jest": "^25.4.0",
59
- "typescript": "^3.8.3",
60
- "uuid": "^3.3.3",
61
- "yup": "^0.29.3"
55
+ "@commitlint/cli": "13.1.0",
56
+ "@commitlint/config-conventional": "13.1.0",
57
+ "@trivago/prettier-plugin-sort-imports": "2.0.4",
58
+ "@tsconfig/node-lts-strictest": "18.12.1",
59
+ "@types/jest": "29.2.4",
60
+ "@types/uuid": "9.0.0",
61
+ "@typescript-eslint/eslint-plugin": "5.46.1",
62
+ "@typescript-eslint/parser": "5.46.1",
63
+ "core-js": "3.26.1",
64
+ "cz-conventional-changelog": "3.3.0",
65
+ "declapract": "^0.10.9",
66
+ "declapract-typescript-ehmpathy": "^0.20.11",
67
+ "depcheck": "1.4.3",
68
+ "eslint": "8.30.0",
69
+ "eslint-config-airbnb-typescript": "17.0.0",
70
+ "eslint-config-prettier": "8.5.0",
71
+ "eslint-plugin-import": "2.26.0",
72
+ "eslint-plugin-prettier": "4.2.1",
73
+ "husky": "7.0.2",
74
+ "jest": "29.3.1",
75
+ "prettier": "2.8.1",
76
+ "ts-jest": "29.0.3",
77
+ "ts-node": "10.9.1",
78
+ "typescript": "4.9.4",
79
+ "uuid": "^3.3.3"
62
80
  },
63
- "dependencies": {}
81
+ "config": {
82
+ "commitizen": {
83
+ "path": "./node_modules/cz-conventional-changelog"
84
+ }
85
+ }
64
86
  }
@@ -89,6 +89,20 @@ await findWrench({
89
89
  })
90
90
  ```
91
91
 
92
+ ### `DropFirst`
93
+
94
+ The generic type `DropFirst` lets you exclude the first element of an array.
95
+
96
+ ```ts
97
+ type NumberStringString = [number, string, string];
98
+ const numStrStr: NumberStringString = [1, '2', '3'];
99
+ const strStr: DropFirst<NumberStringString> = ['1', '2'];
100
+ const str: string = strStr[0];
101
+ const num: number = numStrStr[0];
102
+ ```
103
+
104
+ Useful, for example, if you want to change the first parameter of a function while keeping the rest the same.
105
+
92
106
  ## type guards
93
107
 
94
108
  ### `isPresent`
package/changelog.md DELETED
@@ -1,58 +0,0 @@
1
- # Changelog
2
-
3
- ## [0.6.0](https://www.github.com/ehmpathy/type-fns/compare/v0.5.1...v0.6.0) (2022-11-25)
4
-
5
-
6
- ### Features
7
-
8
- * **checks:** add isNotUndefined and isNotNull checks ([e810bdf](https://www.github.com/ehmpathy/type-fns/commit/e810bdf5e2ec6b9caa3e289aa8a7c693524b5e65))
9
-
10
- ### [0.5.1](https://www.github.com/ehmpathy/type-fns/compare/v0.5.0...v0.5.1) (2022-11-25)
11
-
12
-
13
- ### Bug Fixes
14
-
15
- * **exports:** actually export NotUndefined ([1869b05](https://www.github.com/ehmpathy/type-fns/commit/1869b05e59764b3b822298dac223b9cb09b02fc0))
16
-
17
- ## [0.5.0](https://www.github.com/ehmpathy/type-fns/compare/v0.4.1...v0.5.0) (2022-11-25)
18
-
19
-
20
- ### Features
21
-
22
- * **types:** add the NotUndefined generic type ([bd613c2](https://www.github.com/ehmpathy/type-fns/commit/bd613c27ced111eb44c971734ab343a9cd2fbe8e))
23
-
24
- ### [0.4.1](https://www.github.com/ehmpathy/type-fns/compare/v0.4.0...v0.4.1) (2022-11-24)
25
-
26
-
27
- ### Bug Fixes
28
-
29
- * **exports:** actually export isAPromise, isAFunction, PickOne ([ad5b28f](https://www.github.com/ehmpathy/type-fns/commit/ad5b28f1d2da9fe382d1245d38d970b1b0e7bd1c))
30
-
31
- ## [0.4.0](https://www.github.com/ehmpathy/type-fns/compare/v0.3.0...v0.4.0) (2022-11-24)
32
-
33
-
34
- ### Features
35
-
36
- * **checks:** add isAFunction, isAPromise, and PickOne type checks and generic type ([981ae42](https://www.github.com/ehmpathy/type-fns/commit/981ae4275530bdae203b9013bed193f1afda6b8d))
37
-
38
-
39
- ### Bug Fixes
40
-
41
- * **cicd:** update github actions, test scripts, and swap repo org to ehmpathy ([b6a1458](https://www.github.com/ehmpathy/type-fns/commit/b6a1458b6d2d5423255fc8eaee2e3181d0c14850))
42
- * **doc:** fix comment describing has metadata in code ([d7d2e55](https://www.github.com/ehmpathy/type-fns/commit/d7d2e556ba03ad5a573f90d6ea75c5696f493058))
43
- * **name:** rename package to type-fns ([66258d9](https://www.github.com/ehmpathy/type-fns/commit/66258d93e7964c675b92f50061ddcb11a79f2b69))
44
- * **tests:** remove example of type error from tests ([326123c](https://www.github.com/ehmpathy/type-fns/commit/326123cf845b31e82edb0d3d50cd6034217df2fa))
45
-
46
- ## [0.3.0](https://www.github.com/ehmpathy/type-fns/compare/v0.2.1...v0.3.0) (2022-01-03)
47
-
48
-
49
- ### Features
50
-
51
- * **checks:** add the HasMetadata type modifier ([85f0ca4](https://www.github.com/ehmpathy/type-fns/commit/85f0ca467983ea6f1fc5845990f98dbe9cbe5e8f))
52
-
53
- ### [0.2.1](https://www.github.com/ehmpathy/type-fns/compare/v0.2.0...v0.2.1) (2021-11-16)
54
-
55
-
56
- ### Bug Fixes
57
-
58
- * **enum:** forbid giving isOfEnum functions null or undefined as an input ([98ec621](https://www.github.com/ehmpathy/type-fns/commit/98ec6216bc5775cbb2015f400358fe7d5fffc303))