MCPcopy Create free account
hub / github.com/TruthHun/BookStack / formatPrimitive

Function formatPrimitive

static/word2md/mammoth.browser.js:29811–29827  ·  view source on GitHub ↗
(ctx, value)

Source from the content-addressed store, hash-verified

29809
29810
29811function formatPrimitive(ctx, value) {
29812 if (isUndefined(value))
29813 return ctx.stylize('undefined', 'undefined');
29814 if (isString(value)) {
29815 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
29816 .replace(/'/g, "\\'")
29817 .replace(/\\"/g, '"') + '\'';
29818 return ctx.stylize(simple, 'string');
29819 }
29820 if (isNumber(value))
29821 return ctx.stylize('' + value, 'number');
29822 if (isBoolean(value))
29823 return ctx.stylize('' + value, 'boolean');
29824 // For some reason typeof null is "object", so special case here.
29825 if (isNull(value))
29826 return ctx.stylize('null', 'null');
29827}
29828
29829
29830function formatError(value) {

Callers 1

formatValueFunction · 0.70

Calls 5

isUndefinedFunction · 0.70
isStringFunction · 0.70
isNumberFunction · 0.70
isBooleanFunction · 0.70
isNullFunction · 0.70

Tested by

no test coverage detected