"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/bin/read-package-json.js" (7 Feb 2017, 513 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 var argv = process.argv
    2 if (argv.length < 3) {
    3   console.error('Usage: read-package.json <file> [<fields> ...]')
    4   process.exit(1)
    5 }
    6 
    7 var file = argv[2]
    8 var readJson = require('read-package-json')
    9 
   10 readJson(file, function (er, data) {
   11   if (er) throw er
   12   if (argv.length === 3) {
   13     console.log(data)
   14   } else {
   15     argv.slice(3).forEach(function (field) {
   16       field = field.split('.')
   17       var val = data
   18       field.forEach(function (f) {
   19         val = val[f]
   20       })
   21       console.log(val)
   22     })
   23   }
   24 })