(ctx, value)
| 1121 | |
| 1122 | |
| 1123 | function formatPrimitive(ctx, value) { |
| 1124 | if (isUndefined(value)) |
| 1125 | return ctx.stylize('undefined', 'undefined'); |
| 1126 | if (isString(value)) { |
| 1127 | var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') |
| 1128 | .replace(/'/g, "\\'") |
| 1129 | .replace(/\\"/g, '"') + '\''; |
| 1130 | return ctx.stylize(simple, 'string'); |
| 1131 | } |
| 1132 | if (isNumber(value)) |
| 1133 | return ctx.stylize('' + value, 'number'); |
| 1134 | if (isBoolean(value)) |
| 1135 | return ctx.stylize('' + value, 'boolean'); |
| 1136 | // For some reason typeof null is "object", so special case here. |
| 1137 | if (isNull(value)) |
| 1138 | return ctx.stylize('null', 'null'); |
| 1139 | } |
| 1140 | |
| 1141 | |
| 1142 | function formatError(value) { |
no test coverage detected