diff --git a/lib/utils.js b/lib/utils.js index ac785b14b..3b99e637a 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -451,6 +451,10 @@ function deepMergeProperty(base, extras) { return mergedProperty; } +const numberIsFinite = Number.isFinite || function(value) { + return typeof value === 'number' && isFinite(value); +}; + /** * Adds a property __rank to array elements of type object {} * If an inner element already has the __rank property it is not altered @@ -461,7 +465,7 @@ function deepMergeProperty(base, extras) { * @return rankedArray The original array with newly ranked elements */ function rankArrayElements(array, rank) { - if (!Array.isArray(array) || !Number.isFinite(rank)) + if (!Array.isArray(array) || !numberIsFinite(rank)) return array; array.forEach(function(el) {