Skip to content

Commit

Permalink
fix(comparer): Fixes comparer
Browse files Browse the repository at this point in the history
Fixes comparer to match `Array.prototype.includes` default comparison
  • Loading branch information
mattpodwysocki authored Oct 14, 2017
1 parent 723bb9d commit c6a67eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/internal/comparer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* @ignore
*/
export function comparer(a: any, b: any) {
return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));
return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
}

/**
* @ignore
*/
export async function comparerAsync(a: any, b: any) {
return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));
}
return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
}

0 comments on commit c6a67eb

Please sign in to comment.