declaring variable only once

This commit is contained in:
leider 2014-02-09 14:42:00 +01:00
parent cb910afc52
commit 350a802a4e

View file

@ -147,11 +147,11 @@ module.exports = function (chai, _) {
function include (val, msg) {
if (msg) flag(this, 'message', msg);
var obj = flag(this, 'object');
var expected = false;
if (_.type(obj) === 'array' && _.type(val) === 'object') {
for (var i in obj) {
if (_.eql(obj[i], val))
var expected = true;
expected = true;
}
} else if (_.type(val) === 'object') {
if (!flag(this, 'negate')) {
@ -160,9 +160,9 @@ module.exports = function (chai, _) {
}
var subset = {}
for (var k in val) subset[k] = obj[k]
var expected = _.eql(subset, val);
expected = _.eql(subset, val);
} else {
var expected = obj && ~obj.indexOf(val)
expected = obj && ~obj.indexOf(val)
}
this.assert(
expected