Esempio n. 1
0
 child.once('close', function (code) {
   if (code !== 0) {
     done(new Error('npm exited with status ' + code))
   } else if (outputError) {
     done(outputError)
   } else {
     parseJSON(json, function (error, graph) {
       if (error) return done(error)
       if (!graph.hasOwnProperty('dependencies')) {
         done(new Error('cannot interpret npm ls --json output'))
       } else {
         var flattened = {}
         flattenDependencyTree(graph.dependencies, flattened)
         done(null, flattened)
       }
     })
   }
 })
Esempio n. 2
0
 concat(response, function (error, buffer) {
   if (error) return callback(error)
   parse(buffer, callback)
 })