Skip to content

Commit

Permalink
fix: add polyfill method for array.isArray
Browse files Browse the repository at this point in the history
  • Loading branch information
tivie committed Apr 3, 2022
1 parent fc01abd commit 16cac70
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ showdown.helper.isFunction = function (a) {
*/
showdown.helper.isArray = function (a) {
'use strict';
return Array.isArray(a);
let isArray;
if (!Array.isArray) {
isArray = function (arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
} else {
isArray = Array.isArray;
}
return isArray(a);
};

/**
Expand Down

0 comments on commit 16cac70

Please sign in to comment.