Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Submitting our solution revealed a few bugs in our solution. The first bug can be pointed out with this failing test: expect([].sameStructureAs(1)).to.be.false; We were assuming that `other` would be an array. Unfortunately in this case, `other` is `1`, which causes `_.zipWith` to return an empty array. We can fix this bug by adding an upfront check asserting that `other` is an `Array`. After fixing that issue, another bug reared its ugly head: expect([1].sameStructureAs([1, 2])).to.be.false; In the last iteration of `_.zipWith`, `a` was `undefined` and `b` was `2`. While checking if both of these values were not arrays returned true, we didn't check if both values existed. The fix for this bug is to check that both `a` and `b` are not `undefined`: let bothDefined = !_.isUndefined(a) && !_.isUndefined(b); let bothNot = bothDefined && !_.isArray(a) && !_.isArray(b); With those fixes, out suite flips back to green!
- Loading branch information