Hyperlinkv0.8.0-beta.28

Redactable

Redactable.redactfunctioneffect/Redactable.ts:127
(u: unknown): unknown

Returns a redacted value if it implements Redactable, otherwise returns it unchanged.

When to use

Use as the general-purpose entry point for redaction when the input may or may not implement the redaction protocol.

Details

This function calls isRedactable and, when it returns true, delegates to getRedacted.

Gotchas

Redaction is not recursive. Nested redactable values inside the returned object are not automatically redacted.

export function redact(u: unknown): unknown {
  if (isRedactable(u)) return getRedacted(u)
  return u
}
Referenced by 2 symbols