Skip to content

Commit

Permalink
refactor: avoid function call and reduce loc
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Jun 29, 2024
1 parent 74566db commit c1516a3
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,18 @@ function complex( x, value ) {
function boolean( x, value ) {
var view;
var n;
var v;
var i;

if ( !isBoolean( value ) ) {
return 0;
}
if ( value === false ) {
value = 0;
} else {
value = 1;
}
view = reinterpretBoolean( x, 0 );

v = ( value ) ? 1 : 0;
n = 0;
for ( i = 0; i < view.length; i++ ) {
if ( isSameValueZero( view[ i ], value ) ) {
if ( view[ i ] === v ) {
n += 1;
}
}
Expand Down

0 comments on commit c1516a3

Please sign in to comment.