typeof symbolRedactableDefines the symbol used to identify objects that implement the Redactable protocol.
When to use
Use as the property key when implementing the Redactable protocol.
Details
Add a method under this key to make an object redactable. The method receives
the current Context and must return the replacement value. The symbol is
registered globally via Symbol.for("~effect/Redactable"), so it is
identical across multiple copies of the library at runtime.
Example (Masking an API key)
import { Context, Redactable } from "effect"
class ApiKey {
constructor(readonly raw: string) {}
[Redactable.symbolRedactable](_ctx: Context.Context<never>) {
return this.raw.slice(0, 4) + "..."
}
}export const const symbolRedactable: typeof symbolRedactableDefines the symbol used to identify objects that implement the
Redactable
protocol.
When to use
Use as the property key when implementing the Redactable protocol.
Details
Add a method under this key to make an object redactable. The method receives
the current Context and must return the replacement value. The symbol is
registered globally via Symbol.for("~effect/Redactable"), so it is
identical across multiple copies of the library at runtime.
Example (Masking an API key)
import { Context, Redactable } from "effect"
class ApiKey {
constructor(readonly raw: string) {}
[Redactable.symbolRedactable](_ctx: Context.Context<never>) {
return this.raw.slice(0, 4) + "..."
}
}
symbolRedactable: unique symbol = var Symbol: SymbolConstructorSymbol.SymbolConstructor.for(key: string): symbolReturns a Symbol object from the global symbol registry matching the given key if found.
Otherwise, returns a new symbol with this key.
for("~effect/Redactable")