"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/install/realize-shrinkwrap-specifier.js" (8 Mar 2017, 661 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 'use strict'
    2 var realizePackageSpecifier = require('realize-package-specifier')
    3 var isRegistrySpecifier = require('./is-registry-specifier.js')
    4 
    5 module.exports = function (name, sw, where, cb) {
    6   function lookup (ver, cb) {
    7     realizePackageSpecifier(name + '@' + ver, where, cb)
    8   }
    9   if (sw.resolved) {
   10     return lookup(sw.resolved, cb)
   11   } else if (sw.from) {
   12     return lookup(sw.from, function (err, spec) {
   13       if (err || isRegistrySpecifier(spec)) {
   14         return thenUseVersion()
   15       } else {
   16         return cb(null, spec)
   17       }
   18     })
   19   } else {
   20     return thenUseVersion()
   21   }
   22   function thenUseVersion () {
   23     lookup(sw.version, cb)
   24   }
   25 }