Traversing through a Javascript Object
I’ve started working with Firebase on a project and one of the interesting quirks with storing json data in its real-time database is that objects cannot have any properties that are undefined (you get “ Error: Firebase.set failed: First argument contains undefined in property”). They have to be stored as null instead.
However, after stackoverfloogling the problem i found all posted code snippets failed for my use case. So, here’s one i wrote: it recursively traverses the objects properties, including arrays and inspects all sub objects as well replacing properties that are undefined with null.