Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when global isFinite is undefined #10

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions numberToWords.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Number-To-Words util
* @version v1.2.2
* @version v1.2.3
* @link https://github.com/marlun78/number-to-words
* @author Martin Eneqvist (https://github.com/marlun78)
* @contributors Aleksey Pilyugin (https://github.com/pilyugin)
Expand All @@ -15,7 +15,9 @@

// ========== file: /src/isFinite.js ==========

var globalIsFinite = isFinite;
var globalIsFinite = isFinite || function(value) {
return value < Infinity && value > -Infinity;
};
var isFinite = Number.isFinite || function (value) {
return typeof value === 'number' && globalIsFinite(value);
};
Expand Down
2 changes: 1 addition & 1 deletion numberToWords.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "number-to-words",
"description": "Contains some util methods for converting numbers into words, ordinal words and ordinal numbers.",
"version": "1.2.2",
"version": "1.2.3",
"main": "./src",
"browser": "./numberToWords.min.js",
"author": "Martin Eneqvist (https://github.com/marlun78)",
Expand Down
4 changes: 3 additions & 1 deletion src/isFinite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

var globalIsFinite = isFinite;
var globalIsFinite = isFinite || function(value) {
return value < Infinity && value > -Infinity;
};
var isFinite = Number.isFinite || function (value) {
return typeof value === 'number' && globalIsFinite(value);
};
Expand Down