1.0.1 • Published 4 years ago

fix-unusable-parse-number-polyfill v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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

  • Fix parseInt
  • Fix parseFloat
  • Handle unicode better
  • Make ponyfill
  • RFC

License

MIT