1
0
Fork 0

added derived file

This commit is contained in:
Jan Steemann 2014-12-22 16:15:16 +01:00
parent 77b9bd695a
commit 406bd99800
1 changed files with 7 additions and 24 deletions

View File

@ -1175,37 +1175,20 @@
value.toString === Object.prototype.toString value.toString === Object.prototype.toString
|| (typeof value === 'object' && Object.getPrototypeOf(value) === null) || (typeof value === 'object' && Object.getPrototypeOf(value) === null)
) { ) {
var values, i, handled = false; var handled = false;
try { try {
if (value instanceof Set) { if (value instanceof Set ||
// ES6 Set value instanceof Map ||
values = [ ]; value instanceof WeakSet ||
for (i of value) { value instanceof WeakMap ||
values.push(i); typeof value[Symbol.iterator] === "function") {
}
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") {
// ES6 iterators // ES6 iterators
context.output += value.toString(); context.output += value.toString();
handled = true; handled = true;
} }
} }
catch (err) { catch (err) {
// ignore any errors thrown above, and simply fall back to normal printing
} }
if (! handled) { if (! handled) {