https://github.com/es-shims/number.parseint
An ES-spec-compliant Number.parseInt shim/polyfill/replacement that works as far down as ES3
https://github.com/es-shims/number.parseint
ecmascript es-shims javascript number parseint polyfill shim
Last synced: 4 months ago
JSON representation
An ES-spec-compliant Number.parseInt shim/polyfill/replacement that works as far down as ES3
- Host: GitHub
- URL: https://github.com/es-shims/number.parseint
- Owner: es-shims
- License: mit
- Created: 2021-05-17T18:02:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-05T22:21:11.000Z (about 3 years ago)
- Last Synced: 2025-08-26T12:45:16.199Z (5 months ago)
- Topics: ecmascript, es-shims, javascript, number, parseint, polyfill, shim
- Language: JavaScript
- Homepage:
- Size: 50.8 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Number.parseInt [![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.parseInt` 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.parseint).
## Getting started
```sh
npm install --save number.parseint
```
## Usage/Examples
```js
console.log(Number.parseInt("-3")); // -3
console.log(Number.parseInt("0x10")); // 16
console.log(Number.parseInt("30", 7)); // 21
console.log(Number.parseInt("ef")); // NaN
```
## Tests
Clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/number.parseint
[npm-version-svg]: https://versionbadg.es/es-shims/Number.parseInt.svg
[deps-svg]: https://david-dm.org/es-shims/Number.parseInt.svg
[deps-url]: https://david-dm.org/es-shims/Number.parseInt
[dev-deps-svg]: https://david-dm.org/es-shims/Number.parseInt/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Number.parseInt#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/number.parseint.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/number.parseint.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/number.parseint.svg
[downloads-url]: https://npm-stat.com/charts.html?package=number.parseint
[codecov-image]: https://codecov.io/gh/es-shims/Number.parseInt/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Number.parseInt/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Number.parseInt
[actions-url]: https://github.com/es-shims/Number.parseInt/actions