MCPcopy
hub / github.com/brimdata/zui / jsonHeader

Function jsonHeader

packages/zed-js/src/client/utils.ts:69–74  ·  view source on GitHub ↗
(obj: object)

Source from the content-addressed store, hash-verified

67const charsToEncode = /[\u007f-\uffff]/g;
68
69export function jsonHeader(obj: object) {
70 // https://stackoverflow.com/a/40347926
71 return JSON.stringify(obj).replace(charsToEncode, function (c) {
72 return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4);
73 });
74}
75
76export function wrapAbort(signal?: IsoAbortSignal) {
77 const ctl = new AbortController();

Callers 1

loadMethod · 0.90

Calls 3

toStringMethod · 0.65
replaceMethod · 0.45
stringifyMethod · 0.45

Tested by

no test coverage detected