logical-not
Advanced tools
+4
-1
@@ -1,2 +0,5 @@ | ||
| export declare function not(value: any): boolean; | ||
| export declare function not( | ||
| value: any | ||
| ): value is false | "" | 0 | null | undefined; | ||
| export default not; |
+1
-1
| { | ||
| "name": "logical-not", | ||
| "version": "1.0.7", | ||
| "version": "1.0.9", | ||
| "description": "Logical NOT Function", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+13
-4
@@ -6,3 +6,3 @@ # Logical NOT Function | ||
| For example: | ||
| Usage: | ||
@@ -18,6 +18,15 @@ ```js | ||
| ## Installation | ||
| ### Typescript support | ||
| ```sh | ||
| $ npm install logical-not | ||
| ```ts | ||
| function main(): void { | ||
| const div = document.querySelector("div"); | ||
| // div is HTMLDivElement | null | ||
| if (not(div)) return; | ||
| // now div is HTMLDivElement | ||
| div.textContent; // ok | ||
| // ^ no 'possibly null' error | ||
| } | ||
| ``` | ||
@@ -24,0 +33,0 @@ |
2718
10.04%16
14.29%35
34.62%