From 16cac70aeed7c0079db67f7a5dc31a4a8038b1f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estev=C3=A3o=20Soares=20dos=20Santos?= Date: Sun, 3 Apr 2022 09:36:37 +0100 Subject: [PATCH] fix: add polyfill method for array.isArray Closes #497 --- src/helpers.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/helpers.js b/src/helpers.js index e9403f1..ed33147 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -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); }; /**