Skip to content

Commit

Permalink
Merge pull request #1552 from michaelficarra/patch-9
Browse files Browse the repository at this point in the history
Update: better operator regex in use-isnan rule (fixes #1551)
  • Loading branch information
nzakas committed Dec 6, 2014
2 parents 8e7697c + 47657c2 commit 2cf377a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/use-isnan.js
Expand Up @@ -15,7 +15,7 @@ module.exports = function (context) {

return {
"BinaryExpression": function (node) {
if (/^[<>]=?|^===?|^!==?$/.test(node.operator) && (node.left.name === "NaN" || node.right.name === "NaN")) {
if (/^(?:[<>]|[!=]=)=?$/.test(node.operator) && (node.left.name === "NaN" || node.right.name === "NaN")) {
context.report(node, "Use the isNaN function to compare with NaN.");
}
}
Expand Down

0 comments on commit 2cf377a

Please sign in to comment.