Installation & Quick Start
Install and start using @visulima/redact
Last updated:
Installation & Quick Start
Installation
bash npm install @visulima/redact bash pnpm add @visulima/redact bash yarn add @visulima/redact bash bun add @visulima/redact Import
import { redact, stringAnonymize } from "@visulima/redact";Quick Examples
Redact Object Properties
import { redact } from "@visulima/redact";
const data = {
username: "alice",
password: "secret123",
email: "alice@example.com",
};
const safe = redact(data, ["password"]);
// { username: "alice", password: "<PASSWORD>", email: "alice@example.com" }Anonymize Text
import { stringAnonymize } from "@visulima/redact";
const text = "My email is john@example.com";
const anonymous = stringAnonymize(text);
// "My email is <EMAIL>"Custom Replacement
import { redact } from "@visulima/redact";
const safe = redact(data, ["ssn"], {
replacement: "[REDACTED]",
});