runtime-type-inspector 2.0.1 → 2.0.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.
package/README.md
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# `RuntimeTypeInspector.js` - your personal type-checking assistant 🕵️🐞🐛
|
|
2
2
|
|
|
3
|
-
# Status: under construction,
|
|
4
|
-
# preparing for first release 🚧🏗️🧰🚧
|
|
5
|
-
|
|
6
3
|
`RuntimeTypeInspector.js` alongside `JSDoc` is a powerful tool which works in tandem with `Babel.js` and `TypeScript` to generate type-asserting JavaScript files. Assertion code is injected into debug builds to perform runtime type checking of each function and method at runtime - a step which is required beyond pure static typing to help emerge the Incident Management Lifecycle.
|
|
7
4
|
|
|
8
5
|
The Incident Management Lifecycle is:
|
|
@@ -35,10 +32,16 @@ https://www.youtube.com/watch?v=xOp3YWU6M1g
|
|
|
35
32
|
|
|
36
33
|
[](https://www.youtube.com/watch?v=xOp3YWU6M1g)
|
|
37
34
|
|
|
38
|
-
# Installation
|
|
35
|
+
# Installation
|
|
39
36
|
|
|
40
37
|
```
|
|
41
38
|
npm install runtime-type-inspector
|
|
42
39
|
```
|
|
43
40
|
|
|
44
|
-
Live demo: https://
|
|
41
|
+
Live demo: https://runtimetypeinspector.org/
|
|
42
|
+
|
|
43
|
+
Thank you for reading and testing! You can also open DevTools and run:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
console.log(rtiTranspiler)
|
|
47
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {assertType } from "./assertType.mjs";
|
|
2
2
|
import {typecheckWarn} from "./typecheckWarn.mjs";
|
|
3
3
|
/**
|
|
4
|
+
* @todo Implement checking all possible key/val types
|
|
4
5
|
* @param {*} value
|
|
5
6
|
* @param {*} expect
|
|
6
7
|
* @param {*} loc
|
|
@@ -14,10 +15,10 @@ function validateMap(value, expect, loc, name, critical) {
|
|
|
14
15
|
typecheckWarn(`${loc}> validateType> map> unhandled key '${key}'`);
|
|
15
16
|
return false;
|
|
16
17
|
}
|
|
17
|
-
if (val !== 'any') {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
18
|
+
// if (val !== 'any') {
|
|
19
|
+
// typecheckWarn(`${loc}> validateType> map> expected any, not '${value}'`);
|
|
20
|
+
// return false;
|
|
21
|
+
// }
|
|
21
22
|
let ret = true;
|
|
22
23
|
for (const [k, v] of value) {
|
|
23
24
|
const good = assertType(
|
|
@@ -1133,6 +1133,13 @@ class Stringifier {
|
|
|
1133
1133
|
const {value} = node;
|
|
1134
1134
|
return `${this.spaces.slice(2)}//${value}\n`;
|
|
1135
1135
|
}
|
|
1136
|
+
/**
|
|
1137
|
+
* @param {import("@babel/types").Import} node - The Babel AST node.
|
|
1138
|
+
* @returns {string} Stringification of the node.
|
|
1139
|
+
*/
|
|
1140
|
+
Import(node) {
|
|
1141
|
+
return 'import';
|
|
1142
|
+
}
|
|
1136
1143
|
/**
|
|
1137
1144
|
* @param {import("@babel/types").ImportDeclaration} node - The Babel AST node.
|
|
1138
1145
|
* @returns {string} Stringification of the node.
|