From 2806b8e824c09a2a34ca477ca77fd5bac154d001 Mon Sep 17 00:00:00 2001 From: Stephen Hazleton Date: Thu, 19 Nov 2015 17:30:50 +1300 Subject: [PATCH] Do not allow a negative indentLevel to throw RangeError: Invalid array length - force count to zero if negative --- js/jsonlint/jsl.format.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/jsonlint/jsl.format.js b/js/jsonlint/jsl.format.js index d7f27f7..f722944 100644 --- a/js/jsonlint/jsl.format.js +++ b/js/jsonlint/jsl.format.js @@ -8,6 +8,7 @@ var jsl = typeof jsl === 'undefined' ? {} : jsl; jsl.format = (function () { function repeat(s, count) { + count = count < 0 ? 0 : count; return new Array(count + 1).join(s); }