Skip to content

Commit

Permalink
More eloquent way of getting Boolean value
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Mar 19, 2014
1 parent 620b83a commit b85c090
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion imp/js/compose-dimp.js
Expand Up @@ -52,7 +52,7 @@ var DimpCompose = {
}

DimpCore.doAction('cancelCompose', this.actionParams({
discard: Number(Boolean(discard))
discard: Number(!!discard)
}));
this.updateDraftsMailbox();
return this.closeCompose();
Expand Down
10 changes: 5 additions & 5 deletions imp/js/search.js
Expand Up @@ -454,13 +454,13 @@ var ImpSearch = {
switch (this.data.types[this.criteria[c].t]) {
case 'header':
case 'text':
this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]'))));
this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]')));
this.criteria[c].v = $F($(c).down('INPUT[type=text]'));
data.push(this.criteria[c]);
break;

case 'customhdr':
this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]'))));
this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]')));
this.criteria[c].v = { h: $F($(c).down('INPUT')), s: $F($(c).down('INPUT', 1)) };
data.push(this.criteria[c]);
break;
Expand All @@ -479,7 +479,7 @@ var ImpSearch = {
alert(this.text.need_date);
return;
}
this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]'))));
this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]')));
data.push(this.criteria[c]);
break;

Expand All @@ -489,12 +489,12 @@ var ImpSearch = {
break;

case 'filter':
this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]'))));
this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]')));
data.push(this.criteria[c]);
break;

case 'flag':
this.criteria[c].n = Number(Boolean($F($(c).down('INPUT[type=checkbox]'))));
this.criteria[c].n = Number(!!$F($(c).down('INPUT[type=checkbox]')));
data.push({
n: this.criteria[c].n,
t: 'flag',
Expand Down
2 changes: 1 addition & 1 deletion imp/js/viewport.js
Expand Up @@ -1017,7 +1017,7 @@ var ViewPort = Class.create({

bufferLoaded: function(view)
{
return Boolean(this.views[view]);
return !!this.views[view];
},

currentOffset: function()
Expand Down

0 comments on commit b85c090

Please sign in to comment.