I'd change this to an `else if (value instanceof Object)` just to make sure you don't have a number or something.