⚝
One Hat Cyber Team
⚝
Your IP:
172.22.0.1
Server IP:
151.80.20.34
Server:
Linux 794f04d97d5e 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
Server Software:
Apache/2.4.62 (Debian)
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
nodejs
/
@npmcli
/
disparity-colors
/
lib
/
Edit File: index.js
const ansi = require('ansi-styles') const colors = { removed: ansi.red, added: ansi.green, header: ansi.yellow, section: ansi.magenta, } function colorize (str, opts) { let headerLength = (opts || {}).headerLength if (typeof headerLength !== 'number' || Number.isNaN(headerLength)) { headerLength = 2 } const color = (colorStr, colorId) => { const { open, close } = colors[colorId] // avoid highlighting the "\n" (would highlight till the end of the line) return colorStr.replace(/[^\n\r]+/g, open + '$&' + close) } // this RegExp will include all the `\n` chars into the lines, easier to join const lines = ((typeof str === 'string' && str) || '').split(/^/m) const start = color(lines.slice(0, headerLength).join(''), 'header') const end = lines.slice(headerLength).join('') .replace(/^-.*/gm, color('$&', 'removed')) .replace(/^\+.*/gm, color('$&', 'added')) .replace(/^@@.+@@/gm, color('$&', 'section')) return start + end } module.exports = colorize
Simpan