Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib/node_mod.../npm/lib
File: ping.js
'use strict'
[0] Fix | Delete
[1] Fix | Delete
const npmConfig = require('./config/figgy-config.js')
[2] Fix | Delete
const fetch = require('libnpm/fetch')
[3] Fix | Delete
const figgyPudding = require('figgy-pudding')
[4] Fix | Delete
const log = require('npmlog')
[5] Fix | Delete
const npm = require('./npm.js')
[6] Fix | Delete
const output = require('./utils/output.js')
[7] Fix | Delete
[8] Fix | Delete
const PingConfig = figgyPudding({
[9] Fix | Delete
json: {},
[10] Fix | Delete
registry: {}
[11] Fix | Delete
})
[12] Fix | Delete
[13] Fix | Delete
module.exports = ping
[14] Fix | Delete
[15] Fix | Delete
ping.usage = 'npm ping\nping registry'
[16] Fix | Delete
[17] Fix | Delete
function ping (args, silent, cb) {
[18] Fix | Delete
if (typeof cb !== 'function') {
[19] Fix | Delete
cb = silent
[20] Fix | Delete
silent = false
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
const opts = PingConfig(npmConfig())
[24] Fix | Delete
const registry = opts.registry
[25] Fix | Delete
log.notice('PING', registry)
[26] Fix | Delete
const start = Date.now()
[27] Fix | Delete
return fetch('/-/ping?write=true', opts).then(
[28] Fix | Delete
res => res.json().catch(() => ({}))
[29] Fix | Delete
).then(details => {
[30] Fix | Delete
if (silent) {
[31] Fix | Delete
} else {
[32] Fix | Delete
const time = Date.now() - start
[33] Fix | Delete
log.notice('PONG', `${time / 1000}ms`)
[34] Fix | Delete
if (npm.config.get('json')) {
[35] Fix | Delete
output(JSON.stringify({
[36] Fix | Delete
registry,
[37] Fix | Delete
time,
[38] Fix | Delete
details
[39] Fix | Delete
}, null, 2))
[40] Fix | Delete
} else if (Object.keys(details).length) {
[41] Fix | Delete
log.notice('PONG', `${JSON.stringify(details, null, 2)}`)
[42] Fix | Delete
}
[43] Fix | Delete
}
[44] Fix | Delete
}).nodeify(cb)
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function