Skip to content

Graphorin API reference v0.13.8


Graphorin API reference / @graphorin/observability / redaction/patterns / jsonSafeMask

Function: jsonSafeMask()

ts
function jsonSafeMask(
   source, 
   matchIndex, 
   matchLength, 
   mask): string;

Defined in: packages/observability/src/redaction/patterns.ts:340

Stable

String-returning wrapper around jsonSafeSpan for callers that replace exactly the matched span. Because its signature cannot widen the replaced region, it CANNOT absorb the leading minus of a signed numeric leaf - for {"card":-4111111111111111} it returns the plain unquoted mask (its historical behaviour), which leaves the document unparseable. Prefer jsonSafeSpan in new code; this wrapper is kept for custom catalogues that adopted it in 0.13.4. The same whole-text ambiguity documented on jsonSafeSpan applies.

Parameters

ParameterType
sourcestring
matchIndexnumber
matchLengthnumber
maskstring

Returns

string