When using Deno 0.42.0, I find it difficult to do any type of analysis of objects by using typeof or other inspection techniques I use in JavaScript.
For example:
const form = new FormData();
console.log(`typeof: ${ typeof form }`);
.. just returns object
Similarly, inspecting properties like:
const form = new FormData();
console.log(`props: ${ Object.getOwnPropertyNames(form) }`);
... returns nothing.
At least instanceof does work:
const form = new FormData();
console.log(`props: ${ form instanceof FormData }`);
... returns true
Is there a way in Deno to inspect objects in real time without first knowing what the object type is?
It works exactly like that on the browser too.
typeof
possible return values are:
So it's not possible for you to get another value.
Maybe what you want is .constructor.name
const form = new FormData();
console.log(`class: ${form.constructor.name}`); // FormData
console.log(`props: ${ form instanceof FormData }`); // true