1. @npmcli/redact
Redact sensitive npm information from output
@npmcli/redact
Package: @npmcli/redact
Created by: npm
Last modified: Fri, 26 Apr 2024 17:22:56 GMT
Version: 2.0.0
License: ISC
Downloads: 5,497,749
Repository: https://github.com/npm/redact

Install

npm install @npmcli/redact
yarn add @npmcli/redact

@npmcli/redact

Redact sensitive npm information from output.

API

This will redact npm_ prefixed tokens and UUIDs from values.

It will also replace passwords in stringified URLs.

redact(string)

Redact values from a single value

 const { redact } = require('@npmcli/redact')

redact('https://user:[email protected]/')
// https://user:***@registry.npmjs.org/

redact(`https://registry.npmjs.org/path/npm_${'a'.repeat('36')}`)
// https://registry.npmjs.org/path/npm_***

redactLog(string | string[])

Redact values from a string or array of strings.

This method will also split all strings on \s and = and iterate over them.

 const { redactLog } = require('@npmcli/redact')

redactLog([
  'Something --x=https://user:[email protected]/ foo bar',
  '--url=http://foo:[email protected]',
])
// [
//   'Something --x=https://user:***@registry.npmjs.org/ foo bar',
//   '--url=http://foo:***@registry.npmjs.org/',
// ]

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code