substack/difflet — pull request #5 by papandreou (2012-07-19 07:40:57+00:00)
Title: Avoid JavaScript error when null values are involved

Test case:

```javascript
require('difflet').compare({a:null}, {a:null});
```

Result:

```
TypeError: Object.keys called on non-object
at Function.keys (native)
at Object.stringifier (.../difflet/index.js:190:26)
at Object. (.../difflet/index.js:63:28)
at walker (.../difflet/node_modules/traverse/index.js:190:22)
at .../difflet/node_modules/traverse/index.js:208:29
at Array.forEach (native)
at .../difflet/node_modules/traverse/index.js:298:31
at walker (.../difflet/node_modules/traverse/index.js:203:13)
at walk (.../difflet/node_modules/traverse/index.js:226:6)
at Traverse.forEach (.../difflet/node_modules/traverse/index.js:50:18)
```

This also triggers the error:

```javascript
require('difflet').compare(null, null);
```

The culprit turned out to be the good old `typeof null === "object"` wtf., see attached fix.