Skip to content

Commit

Permalink
Merge branch 'master' into joeferner-master
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Apr 7, 2012
2 parents 642dd51 + 9250084 commit 9681271
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = Traverse;
var traverse = module.exports = function (obj) {
return new Traverse(obj);
};

function Traverse (obj) {
if (!(this instanceof Traverse)) return new Traverse(obj);
this.value = obj;
}

Expand Down Expand Up @@ -274,9 +276,9 @@ var forEach = function (xs, fn) {
};

forEach(Object_keys(Traverse.prototype), function (key) {
Traverse[key] = function (obj) {
traverse[key] = function (obj) {
var args = [].slice.call(arguments, 1);
var t = Traverse(obj);
var t = new Traverse(obj);
return t[key].apply(t, args);
};
});
4 changes: 4 additions & 0 deletions test/lib/deep_equal.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ module.exports = function (a, b) {
notEqual();
}
}
else if (toS(y) === '[object RegExp]'
|| toS(x) === '[object RegExp]') {
if (!x || !y || x.toString() !== y.toString()) notEqual();
}
else if (x instanceof Date || y instanceof Date) {
if (!(x instanceof Date) || !(y instanceof Date)
|| x.getTime() !== y.getTime()) {
Expand Down

0 comments on commit 9681271

Please sign in to comment.