fix-unusable-parse-number-polyfill
v1.0.1
Published
Fixes parseInt and parseFloat which are broken in all major browsers.
Downloads
2
Readme
Fix unusable parseInt and parseFloat
A modern parseInt
for the 2️1️st Century.
Does 💯 look like NaN to you? Of course not.
parseInt
and parseNumber
is currently broken in ALL major web browsers. To make things worse, browser vendors have not shown any public signals fixing this critical issue. This polyfill will make life tolerable.
Installation
You know the drill:
npm install --save fix-unusable-parse-number-polyfill
# or
yarn add fix-unusable-parse-number-polyfill
Usage
Simply require/import the package early in your application:
import 'fix-unusable-parse-number-polyfill';
// or
require('fix-unusable-parse-number-polyfill');
And then safely parse your strings:
parseInt("3️⃣"); // 3
parseInt("💯"); // 100
parseFloat('0.🥇'); // 0.1
TODO
- [x] Fix parseInt
- [x] Fix parseFloat
- [ ] Handle unicode better
- [ ] Make ponyfill
- [ ] RFC