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IAAK,EACf,GAcF,CAGA,SAAS,oBAAoB,CAE7B,kBAAkB,UAAU,UAAY,SAAU,EAAU,GAC1D,OAAO,UAAW,EAAU,EAC9B,EAEA,kBAAkB,UAAU,UAAY,SAAU,GAChD,OAAO,UAAW,EACpB,EAEA,kBAAkB,UAAU,SAAW,SAAU,EAAK,GACpD,OAAO,SAAU,EAAK,EACxB,EAEA,kBAAkB,UAAU,UAAY,WACtC,OAAO,aACT,EAEA,kBAAkB,UAAU,WAAa,SAAU,GACjD,OAAO,WAAY,EACrB,EAEA,OAAO,QAAU","file":"/npm/bandsintown-events@1.0.4/src/BandsInTownEvents.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/bandsintown-events@1.0.4/src/BandsInTownEvents.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*!\n *\n * BandsInTownEvents\n *\n */\n\n\n//modules\nvar reqwest = require('reqwest');\n\n// -------------------------- vars -------------------------- //\nvar searchUrl = \"//api.bandsintown.com/events/search?\";\n\n// -------------------------- helpers -------------------------- //\n  //the protected parameters set\n  //these are always added to the query string\n  var protectedParams = {\n    \"api_version\":\"2.0\",\n      //default 2.0\n      //REQUIRED cannot be changed\n    \"format\":\"json\",\n      //REQUIRED cannot be changed\n    \"callback\":\"bandsintownevents\"\n      //REQUIRED cannot be changed\n  }\n\n  //allowedParams that a user may decide to set\n  //we remove any other params\n  var allowedParams = [\n    \"app_id\",\n      //REQUIRED - the app_id default empty string\n    \"artists\",\n      //REQUIRED - default empty array\n    \"per_page\",\n      //default 50\n    \"page\",\n      //default 1\n    \"date\",\n      //yyyy-mm-dd\n      //yyyy-mm-dd,yyyy-mm-dd (inclusive range)\n      //upcoming\n      //all\n    \"location\",\n      //default is empty - not sent\n      //city,state (US or CA)\n      //city,country\n      //lat,lon\n      //ip address\n      //use_geoip (will use the ip the request came from)\n    \"radius\",\n      //default 50\n      //max 150\n  ];\n\n  //the default parameter set that is used for making api requests.\n  //these values can be set, updated, unset\n  var defaultParams = {\n    \"app_id\":\"\",\n    \"artists\":[]\n  }\n\n  //The actual parameter set used\n  //Created with buildParams\n  var params = {};\n\n  //set a group of parameters\n  function setParams( obj ){\n    for( var key in obj ){\n      defaultParams[key] = obj[key];\n    }\n    mergeParams();\n  }\n\n  //set a single parameter\n  //useful for setting things like location & radius\n  function setParam( key, value ){\n    defaultParams[key] = value;\n    mergeParams();\n  }\n\n  //unset a param if it is set\n  function unsetParam( key ){\n    if( defaultParams.hasOwnProperty(key) ){\n      delete defaultParams[key];\n    }\n  }\n\n  // Utility method to extend properties of an object\n  function extendProperties( source, properties ) {\n    for (var property in properties) {\n      if (properties.hasOwnProperty(property)) {\n        source[property] = properties[property];\n      }\n    }\n    return source;\n  }\n\n  //merge defaults and protected parameters\n  //called after params are updated or set\n  function mergeParams(){\n    params = extendProperties( defaultParams, protectedParams );\n  }\n\n  //serialize the param string\n  //checking for arrays\n  function serialize( obj ) {\n    var str = [];\n    for(var p in obj)\n      if (obj.hasOwnProperty(p)) {\n        //if the value is an array\n        //create a string with values like //key[]=value\n        if( {}.toString.call( obj[p] ) === \"[object Array]\"){\n          for(var i in obj[p] ){\n            str.push(p + \"[]=\" + obj[p][i]);\n          }\n        }else if ( p === \"artists\" ) {\n          str.push(p + \"[]=\" + obj[p]);\n        }else{\n          str.push(p + \"=\" + obj[p]);\n        }\n      }\n    return str.join(\"&\");\n  }\n\n  //make the call for events from the api\n  //return the appropriate callback or errorback\n  function getEvents( callback, errorback ){\n    var url = searchUrl + serialize( params );\n\n    //update reqwest here\n    reqwest({\n        url: url,\n        type: 'jsonp'\n    })\n    .then( function(res){\n      if( res.errors === undefined )\n        return callback(res);\n\n      console.log(\"getEvents Errors: \" + res.errors);\n      return errorback(res);\n\n    }).catch(function(err){\n      console.log( \"getEvents failed!\" );\n      console.log( err );\n    });\n\n    /*bitGet.uhttp.jsonp(url)\n      .then( function(res){\n        if( res.errors === undefined )\n          return callback(res);\n\n        console.log(\"getEvents Errors: \" + res.errors);\n        return errorback(res);\n\n      }).catch(function(err){\n        console.log( \"getEvents failed!\" );\n        console.log( err );\n      });*/\n  }\n\n// -------------------------- bitGet Definition -------------------------- //\n  function BandsInTownEvents(){};\n\n  BandsInTownEvents.prototype.getEvents = function( callback, errorback ){\n    return getEvents( callback, errorback );\n  };\n\n  BandsInTownEvents.prototype.setParams = function( obj ){\n    return setParams( obj );\n  }\n\n  BandsInTownEvents.prototype.setParam = function( key, value ){\n    return setParam( key, value );\n  }\n\n  BandsInTownEvents.prototype.getParams = function(){\n    return defaultParams;\n  }\n\n  BandsInTownEvents.prototype.unsetParam = function( key ){\n    return unsetParam( key );\n  }\n\n  module.exports = BandsInTownEvents;\n"]}