"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm-registry-client/lib/get.js" (8 Mar 2017, 651 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 module.exports = get
    2 
    3 var assert = require('assert')
    4 var url = require('url')
    5 
    6 /*
    7  * This is meant to be overridden in specific implementations if you
    8  * want specialized behavior for metadata (i.e. caching).
    9  */
   10 function get (uri, params, cb) {
   11   assert(typeof uri === 'string', 'must pass registry URI to get')
   12   assert(params && typeof params === 'object', 'must pass params to get')
   13   assert(typeof cb === 'function', 'must pass callback to get')
   14 
   15   var parsed = url.parse(uri)
   16   assert(
   17     parsed.protocol === 'http:' || parsed.protocol === 'https:',
   18     'must have a URL that starts with http: or https:'
   19   )
   20 
   21   this.request(uri, params, cb)
   22 }