mirror of
https://github.com/chaijs/chai
synced 2024-11-15 08:17:14 +00:00
declaring variable only once
This commit is contained in:
parent
cb910afc52
commit
350a802a4e
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue