Permalink
Browse files

fix for iterating over null with Object.keys

  • Loading branch information...
1 parent 229c9d9 commit 9624c15e7515b0d097e16a125b6b53dee18a6ac8 @substack committed Sep 1, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 example/cmp_object.js
  2. +1 −1 index.js
  3. +1 −1 package.json
@@ -3,4 +3,4 @@ var s = difflet({ indent : 2, comment : true }).compare(
{ z : [6,7], a : 'abcdefgh', b : [ 31, 'xxt' ] },
{ x : 5, a : 'abdcefg', b : [ 51, 'xxs' ] }
);
-process.stdout.write(s);
+console.log(s);
View
@@ -186,7 +186,7 @@ function difflet (opts, prev, next) {
}
else if (typeof node == 'object') {
var insertedKey = false;
- var deleted = insertable && typeof prevNode === 'object'
+ var deleted = insertable && prevNode && typeof prevNode === 'object'
? Object.keys(prevNode).filter(function (key) {
return !Object.hasOwnProperty.call(node, key);
})
View
@@ -1,7 +1,7 @@
{
"name" : "difflet",
"description" : "colorful diffs for javascript objects",
- "version" : "0.2.1",
+ "version" : "0.2.2",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/difflet.git"

0 comments on commit 9624c15

Please sign in to comment.