lib/gist.js
function processGithubFile (options, callback) {
  var item = options.item
  var key = options.key
  var json = options.json

  function respond (content) {
    if (isFeatureCollection(content)) {
      content.name = key
      content.updated_at = json.updated_at
      return content
    }
    return false
  }

  if (item.truncated) {
    return request({
      url: item.raw_url
    }, function (err, content) {
      if (err) return callback(err)

      callback(null, respond(content))
    })
  }

  try {
    var content = JSON.parse(item.content)
  } catch (e) {
    var msg = 'could not parse file contents of ' + key + ': ' + e.message
    return callback(new Error(msg))
  }

  callback(null, respond(content))
}
function processGithubFile (options, callback) {
  var item = options.item
  var key = options.key
  var json = options.json

  function respond (content) {
    if (isFeatureCollection(content)) {
      content.name = key
      content.updated_at = json.updated_at
      return content
    }
    return false
  }

  if (item.truncated) {
    return request({
      url: item.raw_url
    }, function (err, content) {
      if (err) return callback(err)

      callback(null, respond(content))
    })
  }

  try {
    var content = JSON.parse(item.content)
  } catch (e) {
    var msg = 'could not parse file contents of ' + key + ': ' + e.message
    return callback(new Error(msg))
  }

  callback(null, respond(content))
}
function processGithubFile ( options , callback ) { var item = options . item var key = options . key var json = options . json function respond ( content ) { if ( isFeatureCollection ( content ) ) { content . name = key content . updated_at = json . updated_at return content } return false } if ( item . truncated ) { return request ( { url : item . raw_url } , function ( err , content ) { if ( err ) return callback ( err ) callback ( null , respond ( content ) ) } ) } try { var content = JSON . parse ( item . content ) } catch ( e ) { var msg = 'could not parse file contents of ' + key + ': ' + e . message return callback ( new Error ( msg ) ) } callback ( null , respond ( content ) ) }
find and parse geojson objects in a given github gist api "files" object

@private
@param  {object}   options - item, key, json
@param  {Function} callback - err, geojson
find and parse geojson objects in a given github gist api files object