mongodb/js-bson — pull request #92 by Prinzhorn (2014-07-30 18:57:03+00:00)
Title: added failing tests for ObjectID.isValid

So basically the whole `ObjectID.isValid` method is messed up. I don't even know what the correct validation code has to look like, since the current code is some of the most confusing code I've seen recently. Instead I added some failing test cases so you can fix it.

```js
ObjectID.isValid = function isValid(id) {
if (id != null && 'number' != typeof id && (id.length != 12 && id.length != 24)) {
return false;
} else {
// Check specifically for hex correctness
if(typeof id == 'string' && id.length == 24) return checkForHexRegExp.test(id);
return true;
}
};
```

WAT? Yoda conditions (`'number' != typeof` vs `typeof id == 'string'`), unnecessary parenthesis, no comments: this code has it all. Sorry, didn't meant to attack anyone.

I'm not using this module, I just came across someone on twitter having issues with it.