You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemmionic5/Mohem/node_modules_/npm/lib/install/and-add-parent-to-errors.js

15 lines
375 B
JavaScript

'use strict'
var moduleName = require('../utils/module-name.js')
var validate = require('aproba')
module.exports = function (parent, cb) {
validate('F', [cb])
return function (er) {
if (!er) return cb.apply(null, arguments)
if (er instanceof Error && parent && parent.package && parent.package.name) {
er.parent = moduleName(parent)
}
cb(er)
}
}