Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
The is-finite npm package is a simple utility that checks if a given value is a finite number. It is a lightweight alternative to the native Number.isFinite function, providing a straightforward way to determine if a value is a finite number.
Check if a value is finite
This feature allows you to check if a given value is a finite number. The code sample demonstrates checking various values, including a finite number, Infinity, and a string.
const isFinite = require('is-finite');
console.log(isFinite(10)); // true
console.log(isFinite(Infinity)); // false
console.log(isFinite('10')); // false
The is-number package checks if a value is a number, which includes both finite and infinite numbers. It provides a broader check compared to is-finite, which only checks for finite numbers.
The lodash.isfinite package is a part of the Lodash library that provides a similar functionality to is-finite. It checks if a value is a finite number, but it is part of a larger utility library, making it useful if you need additional functionalities provided by Lodash.
The is-finite-x package is another alternative that checks if a value is a finite number. It is similar to is-finite but may have different implementation details or additional features.
ES6
Number.isFinite()
ponyfill
Ponyfill: A polyfill that doesn't overwrite the native method
$ npm install --save is-finite
var numIsFinite = require('is-finite');
numIsFinite(4);
//=> true
numIsFinite(Infinity);
//=> false
MIT © Sindre Sorhus
FAQs
ES2015 Number.isFinite() ponyfill
We found that is-finite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.