You can use this function to wrap an object; then if you try and access a property of the object that is not defined it will log an error to the console (or throw an error, if you prefer) helping you to catch programming bugs faster.
If you aren't on a platform that supports ES6 Proxies this will fall
back to just returning the object. If you're running older versions of
node, you may need to run them with
warn-undefined to make any difference.
throwError: set to true to throw errors instead of logging them
disabled: set to true to bypass (e.g. on production)
fallback: changes the default return from
undefinedto whatever's provided here; ⚠️ only works if
var warnUndefined = ;var foo = bar: 'baz' quux: 'fred';var protectedFoo =;foobar; //bazprotectedFoobar; //bazfoonx; //undefinedprotectedFoonx; //Throws error!