• This project
    • Loading...
  • Sign in

김동훈 / OpenSource_Project

%ea%b7%b8%eb%a6%bc1
Go to a project
Toggle navigation Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 1
  • Wiki
  • Snippets
  • Network
  • Create a new issue
  • Builds
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Network
  • Compare
  • Branches
  • Tags
Switch branch/tag
  • OpenSource_Project
  • node_modules
  • googlemaps
  • lib
  • utils
  • jsonParser.js
  • Donghoon Kim's avatar
    google map api 연동 · 785a8c7d
    785a8c7d
    Donghoon Kim authored 2018-12-06 02:34:39 +0900
jsonParser.js 422 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/**
 * Wraps the callback function to convert the output to a javascript object
 */
module.exports = function(callback) {

  if (typeof callback !== 'function') {
    return false;
  }

  return function(err, jsonString) {

    if (err) {
      return callback(err);
    }

    var json;

    try {
      json = JSON.parse(jsonString);
    } catch (e) {
      return callback(e);
    }

    callback(err, json);

  };

};