index.js
function (name, preset) {
    if(typeof name !== 'string') {
      throw new TypeError('snippets#get expects `name` to be a string.');
    }
    if (utils.startsWith(name, './')) {
      return this.read(name);
    }

    // ex: `http(s)://api.github.com/...`
    if (/^\w+:\/\//.test(name) || preset) {
      var snippet = this.downloader
        .fetch(name, preset)
        .download();

      var parsed = url.parse(name);
      this.set(parsed.pathname, snippet);
      return new Snippet(snippet);
    }

    var res = this.snippets[name]
      || this.store.get(name)
      || utils.get(this.snippets, name);
    return new Snippet(res);
  }
function (name, preset) {
    if(typeof name !== 'string') {
      throw new TypeError('snippets#get expects `name` to be a string.');
    }
    if (utils.startsWith(name, './')) {
      return this.read(name);
    }

    // ex: `http(s)://api.github.com/...`
    if (/^\w+:\/\//.test(name) || preset) {
      var snippet = this.downloader
        .fetch(name, preset)
        .download();

      var parsed = url.parse(name);
      this.set(parsed.pathname, snippet);
      return new Snippet(snippet);
    }

    var res = this.snippets[name]
      || this.store.get(name)
      || utils.get(this.snippets, name);
    return new Snippet(res);
  }
function ( name , preset ) { if ( typeof name !== 'string' ) { throw new TypeError ( 'snippets#get expects `name` to be a string.' ) ; } if ( utils . startsWith ( name , './' ) ) { return this . read ( name ) ; } // ex: `http(s)://api.github.com/...` if ( / ^\w+:\/\/ / . test ( name ) || preset ) { var snippet = this . downloader . fetch ( name , preset ) . download ( ) ; var parsed = url . parse ( name ) ; this . set ( parsed . pathname , snippet ) ; return new Snippet ( snippet ) ; } var res = this . snippets [ name ] || this . store . get ( name ) || utils . get ( this . snippets , name ) ; return new Snippet ( res ) ; }
Get a snippet or arbitrary value by `name`. Cached,
local, or remote.

@param  {String} `name`
@param  {Object} `preset` Preset to use if a URL is passed.
@return {Object} Returns the requested snippet.
@name .get
@api public
Get a snippet or arbitrary value by name . Cached local or remote .