https://github.com/es-shims/number.isinteger
An ES-spec-compliant Number.isInteger shim/polyfill/replacement that works as far down as ES3
https://github.com/es-shims/number.isinteger
ecmascript es-shims isinteger javascript number polyfill shim
Last synced: 8 days ago
JSON representation
An ES-spec-compliant Number.isInteger shim/polyfill/replacement that works as far down as ES3
- Host: GitHub
- URL: https://github.com/es-shims/number.isinteger
- Owner: es-shims
- License: mit
- Created: 2016-04-21T19:10:16.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2023-09-07T00:30:59.000Z (about 2 years ago)
- Last Synced: 2025-09-27T11:43:05.033Z (11 days ago)
- Topics: ecmascript, es-shims, isinteger, javascript, number, polyfill, shim
- Language: JavaScript
- Homepage:
- Size: 58.6 KB
- Stars: 4
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Number.isInteger [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url][![npm badge][npm-badge-png]][package-url]
An ESnext spec-compliant `Number.isInteger` shim/polyfill/replacement that works as far down as ES3.
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-number.isinteger).
## Getting started
```sh
npm install --save number.isinteger
```## Usage/Examples
```js
console.log(Number.isInteger(-3)); // true
console.log(Number.isInteger(2 ** 54)); // true
console.log(Number.isInteger(2.3)); // false
console.log(Number.isInteger(Infinity)); // false
console.log(Number.isInteger("7")); // false
```## Tests
Clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/number.isinteger
[npm-version-svg]: https://versionbadg.es/es-shims/Number.isInteger.svg
[deps-svg]: https://david-dm.org/es-shims/Number.isInteger.svg
[deps-url]: https://david-dm.org/es-shims/Number.isInteger
[dev-deps-svg]: https://david-dm.org/es-shims/Number.isInteger/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Number.isInteger#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/number.isinteger.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/number.isinteger.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/number.isinteger.svg
[downloads-url]: https://npm-stat.com/charts.html?package=number.isinteger
[codecov-image]: https://codecov.io/gh/es-shims/Number.isInteger/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Number.isInteger/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Number.isInteger
[actions-url]: https://github.com/es-shims/Number.isInteger/actions