Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed the tests for how typeof a regex is now "object"

  • Loading branch information...
commit 925008491725beec15216147329f3df907285975 1 parent 2c5f693
@substack authored
Showing with 7 additions and 3 deletions.
  1. +3 −3 index.js
  2. +4 −0 test/lib/deep_equal.js
View
6 index.js
@@ -1,4 +1,4 @@
-module.exports = function (obj) {
+var traverse = module.exports = function (obj) {
return new Traverse(obj);
};
@@ -273,9 +273,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);
};
});
View
4 test/lib/deep_equal.js
@@ -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()) {
Please sign in to comment.
Something went wrong with that request. Please try again.