Skip to content

Commit

Permalink
Merge pull request #170 from jwallet/isfinite
Browse files Browse the repository at this point in the history
is finite
  • Loading branch information
stevemao committed Feb 14, 2019
2 parents 905f215 + 18b59b7 commit 67f9413
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
26 changes: 26 additions & 0 deletions README.md
Expand Up @@ -136,6 +136,7 @@ then Lodash/Underscore is the better option.*
**[Lang](#lang)**

1. [_.isEmpty](#_isempty)
1. [_.isFinite](#_isfinite)
1. [_.isNaN](#_isnan)
1. [_.isNil](#_isnil)
1. [_.isNull](#_isnull)
Expand Down Expand Up @@ -1472,6 +1473,31 @@ Checks if value is an empty object, collection, map, or set.
**[⬆ back to top](#quick-links)**
### _.isFinite
Converts value to a finite number.
```js
// Lodash
console.log(_.isFinite('3'))
// output: false
console.log(_.isFinite(3))
// output: true

// Native
console.log(Number.isFinite('3'))
// output: false
console.log(Number.isFinite(3))
// output: true
```
#### Browser Support for `Number.isFinite()`
![Chrome][chrome-image] | ![Edge][edge-image] | ![Firefox][firefox-image] | ![IE][ie-image] | ![Opera][opera-image] | ![Safari][safari-image]
:-: | :-: | :-: | :-: | :-: | :-: |
19.0 ✔ | ✔ | 16.0 ✔ | ✖ | 15.0 ✔ | 9.0 ✔ |
**[⬆ back to top](#quick-links)**
### _.isNaN
Checks if a value is NaN.
Expand Down
5 changes: 4 additions & 1 deletion lib/rules/rules.json
Expand Up @@ -136,7 +136,10 @@
"compatible": true,
"alternative": "Function.prototype.bind()"
},

"isFinite": {
"compatible": true,
"alternative": "Number.isFinite()"
},
"isNaN": {
"ruleName": "is-nan",
"compatible": true,
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/all.js
Expand Up @@ -4,7 +4,7 @@ const assert = require('assert');
const rules = require('../../../lib/rules/all');
const allRules = require('../../../lib/rules/rules');

assert.equal(Object.keys(allRules).length, 48, 'Don\'t miss a rule 😄');
assert.equal(Object.keys(allRules).length, 49, 'Don\'t miss a rule 😄');

const ruleTester = new RuleTester({
parserOptions: { ecmaVersion: 2018, sourceType: "module" }
Expand Down

0 comments on commit 67f9413

Please sign in to comment.