Skip to content
Browse files

Move var declarations for lint

  • Loading branch information...
1 parent 465298f commit 013354221857fae896a5e5c76a5e811cc855e93d @agnoster committed Oct 6, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/matcher.js
View
12 lib/matcher.js
@@ -33,7 +33,7 @@ Matcher.prototype.assert = function(obj, options) {
}
Matcher.prototype._match = function(pattern, given, options, path) {
- var match = {}
+ var match = {}, key, m, length
function test(a, b, message) {
assert.equal(a, b, "At key '" + path + "': expected " + a + ", got " + b)
@@ -48,7 +48,7 @@ Matcher.prototype._match = function(pattern, given, options, path) {
// ignore arrays
assert.ok(pattern, "Expected an Array at " + path + ", got null")
assert.ok(pattern instanceof Array, "Expected an Array at " + path + ", got " + pattern.constructor)
- var length = pattern.length, o = 0, i = 0
+ length = pattern.length, o = 0, i = 0
if (specials(pattern).prefix) {
length--
} else if (specials(pattern).suffix) {
@@ -58,7 +58,7 @@ Matcher.prototype._match = function(pattern, given, options, path) {
assert.equal(given.length, pattern.length, "Arrays are not the same length at " + path)
}
for (; i < length; i++) {
- var m = this._match(pattern[i], given[i + o], options, path + '/' + i)
+ m = this._match(pattern[i], given[i + o], options, path + '/' + i)
mergeCaptures(match, m)
}
} else {
@@ -67,7 +67,7 @@ Matcher.prototype._match = function(pattern, given, options, path) {
if (specials(pattern).glob) {
delete pattern[specials.glob]
} else {
- for (var key in given) {
+ for (key in given) {
if (!given.hasOwnProperty(key)) continue
assert.ok(pattern.hasOwnProperty(key), "At " + path + ", unexpected key \"" + key + "\": " + JSON.stringify(given[key]) )
}
@@ -76,10 +76,10 @@ Matcher.prototype._match = function(pattern, given, options, path) {
assert.ok(given, "Got null at " + path)
assert.equal(given.constructor, pattern.constructor, "Not the same type")
- for (var key in pattern) {
+ for (key in pattern) {
if (!pattern.hasOwnProperty(key)) continue
assert.ok(given.hasOwnProperty(key), "At " + path + ", key '" + key + "' not found")
- var m = this._match(pattern[key], given[key], options, path + '/' + key)
+ m = this._match(pattern[key], given[key], options, path + '/' + key)
mergeCaptures(match, m)
}
}

0 comments on commit 0133542

Please sign in to comment.
Something went wrong with that request. Please try again.