MCPcopy Index your code
hub / github.com/nodejs/node / jsonError

Function jsonError

deps/npm/lib/utils/output-error.js:16–25  ·  view source on GitHub ↗
(error, npm)

Source from the content-addressed store, hash-verified

14}
15
16const jsonError = (error, npm) => {
17 if (error && npm?.loaded && npm?.config.get('json')) {
18 return {
19 code: error.code,
20 summary: (error.summary || []).map(l => l.slice(1).join(' ')).join('\n').trim(),
21 detail: (error.detail || []).map(l => l.slice(1).join(' ')).join('\n').trim(),
22 ...error.json,
23 }
24 }
25}
26
27module.exports = {
28 outputError,

Callers 2

finishMethod · 0.85
execWorkspacesMethod · 0.85

Calls 4

getMethod · 0.65
mapMethod · 0.65
sliceMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected