From 406bd9980099e13e04a022f13efe44afd215462d Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Mon, 22 Dec 2014 16:15:16 +0100 Subject: [PATCH] added derived file --- .../frontend/js/bootstrap/module-internal.js | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js b/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js index 77c3367d81..46eae7aeb0 100644 --- a/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js +++ b/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js @@ -1175,37 +1175,20 @@ value.toString === Object.prototype.toString || (typeof value === 'object' && Object.getPrototypeOf(value) === null) ) { - var values, i, handled = false; + var handled = false; try { - if (value instanceof Set) { - // ES6 Set - values = [ ]; - for (i of value) { - values.push(i); - } - context.output += "[object Set "; - printArray(values, context); - context.output += "]"; - handled = true; - } - else if (value instanceof Map) { - // ES6 Map - values = { }; - for (i of value) { - values[i[0]] = i[1]; - } - context.output += "[object Map "; - printObject(values, context); - context.output += "]"; - handled = true; - } - else if (typeof value[Symbol.iterator] === "function") { + if (value instanceof Set || + value instanceof Map || + value instanceof WeakSet || + value instanceof WeakMap || + typeof value[Symbol.iterator] === "function") { // ES6 iterators context.output += value.toString(); handled = true; } } catch (err) { + // ignore any errors thrown above, and simply fall back to normal printing } if (! handled) {