| Server IP : 121.121.20.254 / Your IP : 216.73.216.41 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/nodejs/node_modules/npm/lib/utils/ |
Upload File : |
const { output, META } = require('proc-log')
const defaultPredicate = (key, value, chalk) => {
if (value === null || value === undefined) {
return null
}
return chalk.green(value)
}
function logObject (values, { chalk, json, predicate = defaultPredicate }) {
if (json) {
output.standard(JSON.stringify(values, null, 2), { [META]: true, redact: false })
return
}
const lines = []
for (const [key, value] of Object.entries(values)) {
const formatted = predicate(key, value, chalk)
if (formatted !== null) {
lines.push(`${chalk.cyan(key)}: ${formatted}`)
}
}
if (lines.length) {
output.standard(lines.join('\n'), { [META]: true, redact: false })
}
}
function logStageItem (item, { chalk }) {
const { id, packageName, version, tag, createdAt, actor, actorType, shasum, ...rest } = item
logObject({
id,
'package name': packageName,
version,
tag,
'date staged': createdAt,
'staged by': actorType ? `${actor} (${actorType})` : actor,
shasum,
...rest,
}, { chalk })
}
module.exports = { logObject, logStageItem, defaultPredicate }