JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.rawgit.com/maierfelix/Iroh/b84dde46/dist/iroh-browser.js"></script>
<div id="input">
let obj = {
a: 10,
b: null,
c: undefined
};
obj["d"] = undefined;
</div>
Open your console
CSS
#input {
display: none;
}
JavaScript
let stage = new Iroh.Stage(input.textContent);
// listen for object and array creations
// e.g. {}, []
stage.addListener(Iroh.ALLOC).on("fire", function(e) {
// only validate objects
if (e.value instanceof Object) {
let obj = e.value;
// find undefined object keys
for (let key in obj) {
if (obj[key] === undefined) {
// do something
console.warn(key, "in", obj, "is undefined");
}
};
}
});
// listen for assignment expressions
// e.g a = 1, obj[key] = 1 ...
stage.addListener(Iroh.ASSIGN).on("fire", function(e) {
if (e.object instanceof Object && e.result === undefined) {
console.warn(e.property, "in", e.object, "is undefined");
}
});
eval(stage.script);