lib/gist.js
function gist (options, callback) {
  if (!options.id) return callback(new Error('missing option: id'))

  request({
    url: '/gists/' + options.id,
    qs: {
      access_token: options.token
    }
  }, function (err, json) {
    if (err) return callback(err)

    var results = []

    async.forEachOf(json.files, function (item, key, callback) {
      processGithubFile({
        item: item,
        key: key,
        json: json
      }, function (err, geojson) {
        if (err) return callback(err)
        if (geojson) results.push(geojson)
        callback(null)
      })
    }, function (err) {
      if (err) return callback(err)
      if (!results.length) return callback(new Error('no geojson found in gist ' + options.id))
      callback(null, results)
    })
  })
}
function gist (options, callback) {
  if (!options.id) return callback(new Error('missing option: id'))

  request({
    url: '/gists/' + options.id,
    qs: {
      access_token: options.token
    }
  }, function (err, json) {
    if (err) return callback(err)

    var results = []

    async.forEachOf(json.files, function (item, key, callback) {
      processGithubFile({
        item: item,
        key: key,
        json: json
      }, function (err, geojson) {
        if (err) return callback(err)
        if (geojson) results.push(geojson)
        callback(null)
      })
    }, function (err) {
      if (err) return callback(err)
      if (!results.length) return callback(new Error('no geojson found in gist ' + options.id))
      callback(null, results)
    })
  })
}
function gist ( options , callback ) { if ( ! options . id ) return callback ( new Error ( 'missing option: id' ) ) request ( { url : '/gists/' + options . id , qs : { access_token : options . token } } , function ( err , json ) { if ( err ) return callback ( err ) var results = [ ] async . forEachOf ( json . files , function ( item , key , callback ) { processGithubFile ( { item : item , key : key , json : json } , function ( err , geojson ) { if ( err ) return callback ( err ) if ( geojson ) results . push ( geojson ) callback ( null ) } ) } , function ( err ) { if ( err ) return callback ( err ) if ( ! results . length ) return callback ( new Error ( 'no geojson found in gist ' + options . id ) ) callback ( null , results ) } ) } ) }
get geojson from a gist

@param  {object}   options - id, token (optional)
@param  {Function} callback - err, data
get geojson from a gist