type-fns 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
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
+
3
10
  ### [0.5.1](https://www.github.com/ehmpathy/type-fns/compare/v0.5.0...v0.5.1) (2022-11-25)
4
11
 
5
12
 
@@ -0,0 +1,11 @@
1
+ /**
2
+ * narrows the type to remove undefined
3
+ *
4
+ * ref
5
+ * - https://stackoverflow.com/a/63045455/3068233
6
+ */
7
+ export declare type NotNull<T> = T extends null ? never : T;
8
+ /**
9
+ * checks whether the value is not undefined
10
+ */
11
+ export declare const isNotNull: <T>(val: T) => val is NotNull<T>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNotNull = void 0;
4
+ /**
5
+ * checks whether the value is not undefined
6
+ */
7
+ exports.isNotNull = (val) => val !== null;
8
+ //# sourceMappingURL=isNotNull.js.map
@@ -0,0 +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"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * narrows the type to remove undefined
3
+ *
4
+ * ref
5
+ * - https://stackoverflow.com/a/63045455/3068233
6
+ */
7
+ export declare type NotUndefined<T> = T extends undefined ? never : T;
8
+ /**
9
+ * checks whether the value is not undefined
10
+ */
11
+ export declare const isNotUndefined: <T>(val: T) => val is NotUndefined<T>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNotUndefined = void 0;
4
+ /**
5
+ * checks whether the value is not undefined
6
+ */
7
+ exports.isNotUndefined = (val) => typeof val !== 'undefined';
8
+ //# sourceMappingURL=isNotUndefined.js.map
@@ -0,0 +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"}
package/dist/index.d.ts CHANGED
@@ -7,4 +7,5 @@ export * from './wrappers/withNot';
7
7
  export * from './checks/isAFunction';
8
8
  export * from './checks/isAPromise';
9
9
  export * from './types/PickOne';
10
- export * from './types/NotUndefined';
10
+ export * from './checks/isNotNull';
11
+ export * from './checks/isNotUndefined';
package/dist/index.js CHANGED
@@ -19,5 +19,6 @@ __exportStar(require("./wrappers/withNot"), exports);
19
19
  __exportStar(require("./checks/isAFunction"), exports);
20
20
  __exportStar(require("./checks/isAPromise"), exports);
21
21
  __exportStar(require("./types/PickOne"), exports);
22
- __exportStar(require("./types/NotUndefined"), exports);
22
+ __exportStar(require("./checks/isNotNull"), exports);
23
+ __exportStar(require("./checks/isNotUndefined"), exports);
23
24
  //# 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,uDAAqC"}
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,7 +0,0 @@
1
- /**
2
- * narrows the type to remove undefined
3
- *
4
- * ref
5
- * - https://stackoverflow.com/a/63045455/3068233
6
- */
7
- export declare type NotUndefined<T> = T extends undefined ? never : T;
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
2
  //# sourceMappingURL=NotUndefined.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-fns",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "A set of types, type checks, and type guards for simpler, safer, and easier to read code.",
5
5
  "author": "UladKasach @uladkasach",
6
6
  "license": "MIT",