1
0
Fork 0

limit string on output

This commit is contained in:
Frank Celler 2013-07-21 10:17:51 +02:00
parent 741e42230a
commit 5aa74e9822
1 changed files with 8 additions and 0 deletions

View File

@ -925,6 +925,7 @@
var useColor = context.useColor;
var customInspect = context.customInspect;
var useToString = context.useToString;
var limitString = context.limitString;
if (typeof context.seen === "undefined") {
context.seen = [];
@ -1019,6 +1020,12 @@
context.output += colors.COLOR_STRING;
}
if (limitString) {
if (limitString < value.length) {
value = value.substr(0, limitString) + "...";
}
}
context.output += quoteJsonString(value);
if (useColor) {
@ -1134,6 +1141,7 @@
prettyPrint: usePrettyPrint,
useColor: useColor,
customInspect: true,
limitString: 80,
useToString: true
};