From c265a5491532e9f94d08849d6fa70df69c4cdaef Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 5 Apr 2017 11:28:28 -0700 Subject: [PATCH] remove string.trim() shim --- index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/index.js b/index.js index 7010056..47d9450 100644 --- a/index.js +++ b/index.js @@ -1564,7 +1564,7 @@ var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g function base64clean (str) { // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') + str = str.trim().replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not @@ -1574,11 +1574,6 @@ function base64clean (str) { return str } -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) -- 2.34.1