This question, for example, asks:
How to elegantly check if any field has a longer value between two objects in JS?
and gives the following input:
item1 = {a:[1], b:[2], c:[3]}
item2 = {a:[1], b:[2], c:[3,4]}
Don't get me wrong: I think the answers posted there are stellar. However, they don't cover the edge case where some key might not contain an Array.
Is that a problem? Are answers expected to provide code snippets that cover every edge case?
For what it's worth, I think that it's out of scope to cover edge-cases in answers. Instead, the asker should be responsible for adapting the provided code to production-level quality.
What if x doesnt contain value y
. I'm guessing from your comment you mean only the immediate problem as stated.