google-places-web
Advanced tools
Comparing version 0.1.11 to 0.2.0
@@ -1,7 +0,610 @@ | ||
parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r},p.cache={};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({"Xnuv":[function(require,module,exports) { | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GOOGLE_PLACES_API="https://maps.googleapis.com/maps/api/place/",exports.PlaceTypes={ADDRESS:"address",ADMINISTRATIVE_AREA_LEVEL_1:"administrative_area_level_1",ADMINISTRATIVE_AREA_LEVEL_2:"administrative_area_level_2",CITIES:"(cities)",COUNTRY:"country",ESTABLISHMENT:"establishment",GEOCODE:"geocode",LOCALITY:"locality",POSTAL_CODE:"postal_code",REGIONS:"(regions)",SUBLOCALITY:"sublocality"},exports.API={AUTOCOMPLETE:{optionalKeys:["offset","location","radius","language","types","strictbounds","components","sessiontoken"],path:"autocomplete",requiredKeys:["input"]},DETAILS:{optionalKeys:["language","sessiontoken"],path:"details",requiredKeys:["placeid"]},NEARBY_SEARCH:{optionalKeys:["radius","keyword","language","minprice","maxprice","name","opennow","rankby","type","pagetoken","region"],path:"nearbysearch",requiredKeys:["location"]},RADAR_SEARCH:{optionalKeys:["keyword","language","minprice","maxprice","name","opennow","type"],path:"radarsearch",requiredKeys:["location","radius"]},TEXT_SEARCH:{optionalKeys:["location","radius","language","minprice","maxprice","opennow","pagetoken","type"],path:"textsearch",requiredKeys:["query"]}}; | ||
// modules are defined as an array | ||
// [ module function, map of requires ] | ||
// | ||
// map of requires is short require name -> numeric require | ||
// | ||
// anything defined in a previous bundle is accessed via the | ||
// orig method which is the require for previous bundles | ||
parcelRequire = (function (modules, cache, entry, globalName) { | ||
// Save the require from previous bundle to this closure if any | ||
var previousRequire = typeof parcelRequire === 'function' && parcelRequire; | ||
var nodeRequire = typeof require === 'function' && require; | ||
function newRequire(name, jumped) { | ||
if (!cache[name]) { | ||
if (!modules[name]) { | ||
// if we cannot find the module within our internal map or | ||
// cache jump to the current global require ie. the last bundle | ||
// that was added to the page. | ||
var currentRequire = typeof parcelRequire === 'function' && parcelRequire; | ||
if (!jumped && currentRequire) { | ||
return currentRequire(name, true); | ||
} | ||
// If there are other bundles on this page the require from the | ||
// previous one is saved to 'previousRequire'. Repeat this as | ||
// many times as there are bundles until the module is found or | ||
// we exhaust the require chain. | ||
if (previousRequire) { | ||
return previousRequire(name, true); | ||
} | ||
// Try the node require function if it exists. | ||
if (nodeRequire && typeof name === 'string') { | ||
return nodeRequire(name); | ||
} | ||
var err = new Error('Cannot find module \'' + name + '\''); | ||
err.code = 'MODULE_NOT_FOUND'; | ||
throw err; | ||
} | ||
localRequire.resolve = resolve; | ||
localRequire.cache = {}; | ||
var module = cache[name] = new newRequire.Module(name); | ||
modules[name][0].call(module.exports, localRequire, module, module.exports, this); | ||
} | ||
return cache[name].exports; | ||
function localRequire(x){ | ||
return newRequire(localRequire.resolve(x)); | ||
} | ||
function resolve(x){ | ||
return modules[name][1][x] || x; | ||
} | ||
} | ||
function Module(moduleName) { | ||
this.id = moduleName; | ||
this.bundle = newRequire; | ||
this.exports = {}; | ||
} | ||
newRequire.isParcelRequire = true; | ||
newRequire.Module = Module; | ||
newRequire.modules = modules; | ||
newRequire.cache = cache; | ||
newRequire.parent = previousRequire; | ||
newRequire.register = function (id, exports) { | ||
modules[id] = [function (require, module) { | ||
module.exports = exports; | ||
}, {}]; | ||
}; | ||
var error; | ||
for (var i = 0; i < entry.length; i++) { | ||
try { | ||
newRequire(entry[i]); | ||
} catch (e) { | ||
// Save first error but execute all entries | ||
if (!error) { | ||
error = e; | ||
} | ||
} | ||
} | ||
if (entry.length) { | ||
// Expose entry point to Node, AMD or browser globals | ||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js | ||
var mainExports = newRequire(entry[entry.length - 1]); | ||
// CommonJS | ||
if (typeof exports === "object" && typeof module !== "undefined") { | ||
module.exports = mainExports; | ||
// RequireJS | ||
} else if (typeof define === "function" && define.amd) { | ||
define(function () { | ||
return mainExports; | ||
}); | ||
// <script> | ||
} else if (globalName) { | ||
this[globalName] = mainExports; | ||
} | ||
} | ||
// Override the current require with this new one | ||
parcelRequire = newRequire; | ||
if (error) { | ||
// throw error from earlier, _after updating parcelRequire_ | ||
throw error; | ||
} | ||
return newRequire; | ||
})({"Xnuv":[function(require,module,exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.GOOGLE_PLACES_API = "https://maps.googleapis.com/maps/api/place/"; | ||
exports.PlaceTypes = { | ||
ADDRESS: "address", | ||
ADMINISTRATIVE_AREA_LEVEL_1: "administrative_area_level_1", | ||
ADMINISTRATIVE_AREA_LEVEL_2: "administrative_area_level_2", | ||
CITIES: "(cities)", | ||
COUNTRY: "country", | ||
ESTABLISHMENT: "establishment", | ||
GEOCODE: "geocode", | ||
LOCALITY: "locality", | ||
POSTAL_CODE: "postal_code", | ||
REGIONS: "(regions)", | ||
SUBLOCALITY: "sublocality" | ||
}; | ||
exports.API = { | ||
AUTOCOMPLETE: { | ||
optionalKeys: ["offset", "location", "radius", "language", "types", "strictbounds", "components", "sessiontoken"], | ||
path: "autocomplete", | ||
requiredKeys: ["input"] | ||
}, | ||
DETAILS: { | ||
optionalKeys: ["language", "sessiontoken"], | ||
path: "details", | ||
requiredKeys: ["placeid"] | ||
}, | ||
NEARBY_SEARCH: { | ||
optionalKeys: ["radius", "keyword", "language", "minprice", "maxprice", "name", "opennow", "rankby", "type", "pagetoken", "region"], | ||
path: "nearbysearch", | ||
requiredKeys: ["location"] | ||
}, | ||
RADAR_SEARCH: { | ||
optionalKeys: ["keyword", "language", "minprice", "maxprice", "name", "opennow", "type"], | ||
path: "radarsearch", | ||
requiredKeys: ["location", "radius"] | ||
}, | ||
TEXT_SEARCH: { | ||
optionalKeys: ["location", "radius", "language", "minprice", "maxprice", "opennow", "pagetoken", "type"], | ||
path: "textsearch", | ||
requiredKeys: ["query"] | ||
} | ||
}; | ||
},{}],"b2Gr":[function(require,module,exports) { | ||
"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++)for(var n in e=arguments[t])Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}).apply(this,arguments)},e=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("axios")),i=e(require("query-string")),n=require("./Constants"),o=t.default.create({baseURL:"https://maps.googleapis.com/maps/api/place"}),a=function(){function e(r){void 0===r&&(r={}),this._debug=!1;var e=r.apiKey,t=r.debug;this.apiKey=e,this.debug=t}return e.prototype.autocomplete=function(r){var e=this._permitParams(n.API.AUTOCOMPLETE,r);return this._query(n.API.AUTOCOMPLETE.path,e).then(function(r){return r.predictions})},e.prototype.details=function(r){var e=this._permitParams(n.API.DETAILS,r);return this._query(n.API.DETAILS.path,e).then(function(r){return r.result})},e.prototype.nearbysearch=function(r){void 0===r&&(r={});var e=this._permitParams(n.API.NEARBY_SEARCH,r);return this._query(n.API.NEARBY_SEARCH.path,e).then(function(r){return r.results})},e.prototype.textsearch=function(r){void 0===r&&(r={});var e=this._permitParams(n.API.TEXT_SEARCH,r);return this._query(n.API.TEXT_SEARCH.path,e).then(function(r){return r.results})},e.prototype.radarsearch=function(r){void 0===r&&(r={});var e=this._permitParams(n.API.RADAR_SEARCH,r);if(!e.name&&!e.keyword&&!e.type)throw new Error("Missing required parameter: [keyword, name, or type]");return this._query(n.API.RADAR_SEARCH.path,e).then(function(r){return r.results})},Object.defineProperty(e.prototype,"apiKey",{get:function(){return this._apiKey},set:function(r){if(r&&("string"!=typeof r||!r.match(/^[^\s]+$/gi)))throw new Error("Invalid API Key");this._apiKey=r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"debug",{set:function(r){this._debug=r},enumerable:!0,configurable:!0}),e.prototype._permitParams=function(e,t){var i=e.requiredKeys,n=e.optionalKeys;if(!i||!i.length)throw new Error("No required params defined");if(!t)throw new Error("No parameters provided");var o=[],a=i.reduce(function(r,e){var i=t[e];return i?r[e]=i:o.push(e),r},{});if(o.length)throw new Error("Missing required params: ["+o.join(", ")+"]");var s=n.reduce(function(r,e){var i=t[e];return i&&(r[e]=i),r},{});return this._log("google-places-web (params)",JSON.stringify(t)),r({},s,a)},e.prototype._log=function(r,e){this._debug&&console.log(r,e)},e.prototype._buildUri=function(r,e){if(!this._apiKey)throw new Error("Invalid API key");if(!r)throw new Error("Google API path is required");if(!e)throw new Error("Missing params");var t=["/"+r+"/json","?key="+this._apiKey].join("")+"&"+i.default.stringify(e);return this._log("google-places-web (query)",t),t},e.prototype._query=function(r,e){var t=this,i=this._buildUri(r,e);return o.get(i).then(function(r){var e=r.data;if(t._log("google-places-web (data)",e),"OK"!==e.status)throw new Error(e.status);return e}).catch(function(r){throw r})},e}();exports.GooglePlaces=a,exports.default=new a; | ||
"use strict"; | ||
var __assign = this && this.__assign || function () { | ||
__assign = Object.assign || function (t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { | ||
try { | ||
step(generator.next(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function rejected(value) { | ||
try { | ||
step(generator["throw"](value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function step(result) { | ||
result.done ? resolve(result.value) : new P(function (resolve) { | ||
resolve(result.value); | ||
}).then(fulfilled, rejected); | ||
} | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = this && this.__generator || function (thisArg, body) { | ||
var _ = { | ||
label: 0, | ||
sent: function () { | ||
if (t[0] & 1) throw t[1]; | ||
return t[1]; | ||
}, | ||
trys: [], | ||
ops: [] | ||
}, | ||
f, | ||
y, | ||
t, | ||
g; | ||
return g = { | ||
next: verb(0), | ||
"throw": verb(1), | ||
"return": verb(2) | ||
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () { | ||
return this; | ||
}), g; | ||
function verb(n) { | ||
return function (v) { | ||
return step([n, v]); | ||
}; | ||
} | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: | ||
case 1: | ||
t = op; | ||
break; | ||
case 4: | ||
_.label++; | ||
return { | ||
value: op[1], | ||
done: false | ||
}; | ||
case 5: | ||
_.label++; | ||
y = op[1]; | ||
op = [0]; | ||
continue; | ||
case 7: | ||
op = _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { | ||
_ = 0; | ||
continue; | ||
} | ||
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { | ||
_.label = op[1]; | ||
break; | ||
} | ||
if (op[0] === 6 && _.label < t[1]) { | ||
_.label = t[1]; | ||
t = op; | ||
break; | ||
} | ||
if (t && _.label < t[2]) { | ||
_.label = t[2]; | ||
_.ops.push(op); | ||
break; | ||
} | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); | ||
continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { | ||
op = [6, e]; | ||
y = 0; | ||
} finally { | ||
f = t = 0; | ||
} | ||
if (op[0] & 5) throw op[1]; | ||
return { | ||
value: op[0] ? op[1] : void 0, | ||
done: true | ||
}; | ||
} | ||
}; | ||
var __importStar = this && this.__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var superagent = __importStar(require("superagent")); | ||
var Constants_1 = require("./Constants"); | ||
var GOOGLE_MAPS_API_TARGET = "https://maps.googleapis.com/maps/api/place"; | ||
var GooglePlaces = function () { | ||
function GooglePlaces(opts) { | ||
if (opts === void 0) { | ||
opts = { | ||
debug: false | ||
}; | ||
} | ||
this._debug = false; | ||
var apiKey = opts.apiKey, | ||
debug = opts.debug; | ||
this.apiKey = apiKey; | ||
this.debug = debug; | ||
} | ||
GooglePlaces.prototype.autocomplete = function (opts) { | ||
return __awaiter(this, void 0, Promise, function () { | ||
var params, res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
params = this._permitParams(Constants_1.API.AUTOCOMPLETE, opts); | ||
return [4, this._query(Constants_1.API.AUTOCOMPLETE.path, params)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2, res.predictions]; | ||
} | ||
}); | ||
}); | ||
}; | ||
GooglePlaces.prototype.details = function (opts) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var params, json; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
params = this._permitParams(Constants_1.API.DETAILS, opts); | ||
return [4, this._query(Constants_1.API.DETAILS.path, params)]; | ||
case 1: | ||
json = _a.sent(); | ||
return [2, json.result]; | ||
} | ||
}); | ||
}); | ||
}; | ||
GooglePlaces.prototype.nearbysearch = function (opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
return __awaiter(this, void 0, Promise, function () { | ||
var params, res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
params = this._permitParams(Constants_1.API.NEARBY_SEARCH, opts); | ||
return [4, this._query(Constants_1.API.NEARBY_SEARCH.path, params)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2, res.results]; | ||
} | ||
}); | ||
}); | ||
}; | ||
GooglePlaces.prototype.textsearch = function (opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
return __awaiter(this, void 0, Promise, function () { | ||
var params, res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
params = this._permitParams(Constants_1.API.TEXT_SEARCH, opts); | ||
return [4, this._query(Constants_1.API.TEXT_SEARCH.path, params)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2, res.results]; | ||
} | ||
}); | ||
}); | ||
}; | ||
GooglePlaces.prototype.radarsearch = function (opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
return __awaiter(this, void 0, Promise, function () { | ||
var params, res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
params = this._permitParams(Constants_1.API.RADAR_SEARCH, opts); | ||
if (!params.name && !params.keyword && !params.type) { | ||
throw new Error("Missing required parameter: [keyword, name, or type]"); | ||
} | ||
return [4, this._query(Constants_1.API.RADAR_SEARCH.path, params)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2, res.results]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Object.defineProperty(GooglePlaces.prototype, "apiKey", { | ||
get: function () { | ||
return this._apiKey; | ||
}, | ||
set: function (apiKey) { | ||
if (apiKey && (typeof apiKey !== "string" || !apiKey.match(/^[^\s]+$/gi))) { | ||
throw new Error("Invalid API Key"); | ||
} | ||
this._apiKey = apiKey; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(GooglePlaces.prototype, "debug", { | ||
set: function (isDebug) { | ||
this._debug = isDebug; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
GooglePlaces.prototype._googleApiRequest = function (url, params) { | ||
var target = "" + GOOGLE_MAPS_API_TARGET + url; | ||
this._log("GPW:REQ " + target, JSON.stringify(__assign({}, params))); | ||
return superagent.get(target).query(__assign({ | ||
key: this.apiKey | ||
}, params)); | ||
}; | ||
GooglePlaces.prototype._permitParams = function (_a, params) { | ||
var requiredKeys = _a.requiredKeys, | ||
optionalKeys = _a.optionalKeys; | ||
if (!requiredKeys || !requiredKeys.length) { | ||
throw new Error("No required params defined"); | ||
} else if (!params) { | ||
throw new Error("No parameters provided"); | ||
} | ||
var missingKeys = []; | ||
var filteredRequiredParams = requiredKeys.reduce(function (p, key) { | ||
var param = params[key]; | ||
if (param) { | ||
p[key] = param; | ||
} else { | ||
missingKeys.push(key); | ||
} | ||
return p; | ||
}, {}); | ||
if (missingKeys.length) { | ||
throw new Error("Missing required params: [" + missingKeys.join(", ") + "]"); | ||
} | ||
var filteredOptionalParams = optionalKeys.reduce(function (p, key) { | ||
var param = params[key]; | ||
if (param) { | ||
p[key] = param; | ||
} | ||
return p; | ||
}, {}); | ||
this._log("GPW:PARAMS", JSON.stringify(params)); | ||
return __assign({}, filteredOptionalParams, filteredRequiredParams); | ||
}; | ||
GooglePlaces.prototype._log = function (title, message) { | ||
if (this._debug) { | ||
console.log(title, message); | ||
} | ||
}; | ||
GooglePlaces.prototype._query = function (path, params) { | ||
return __awaiter(this, void 0, Promise, function () { | ||
var response, body, error_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!this._apiKey) { | ||
throw new Error("Invalid API key"); | ||
} else if (!path) { | ||
throw new Error("Google API path is required"); | ||
} else if (!params) { | ||
throw new Error("Missing params"); | ||
} | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3,, 4]); | ||
return [4, this._googleApiRequest("/" + path + "/json", params)]; | ||
case 2: | ||
response = _a.sent(); | ||
body = response.body; | ||
this._log("GPW:RES", body); | ||
if (body.status !== "OK") { | ||
throw new Error(body.status); | ||
} | ||
return [2, body]; | ||
case 3: | ||
error_1 = _a.sent(); | ||
throw error_1; | ||
case 4: | ||
return [2]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return GooglePlaces; | ||
}(); | ||
exports.GooglePlaces = GooglePlaces; | ||
exports.default = new GooglePlaces(); | ||
},{"./Constants":"Xnuv"}],"7QCb":[function(require,module,exports) { | ||
"use strict";var e=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r};Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("./Places"));exports.GooglePlaces=r.GooglePlaces;var t=require("./Constants");exports.GOOGLE_PLACES_API=t.GOOGLE_PLACES_API,exports.API=t.API,exports.default=r.default; | ||
},{"./Places":"b2Gr","./Constants":"Xnuv"}]},{},["7QCb"], null) | ||
"use strict"; | ||
var __importStar = this && this.__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var Places_1 = __importStar(require("./Places")); | ||
exports.GooglePlaces = Places_1.GooglePlaces; | ||
var Constants_1 = require("./Constants"); | ||
exports.GOOGLE_PLACES_API = Constants_1.GOOGLE_PLACES_API; | ||
exports.API = Constants_1.API; | ||
exports.default = Places_1.default; | ||
},{"./Places":"b2Gr","./Constants":"Xnuv"}]},{},["7QCb"], null) | ||
//# sourceMappingURL=/index.js.map |
{ | ||
"name": "google-places-web", | ||
"version": "0.1.11", | ||
"version": "0.2.0", | ||
"description": "A simple wrapper for the Google Places Web API", | ||
@@ -9,5 +9,5 @@ "main": "dist/index.js", | ||
"test:watch": "jest --verbose --watch", | ||
"compile": "yarn build", | ||
"build": "parcel build ./src/google/index.ts --target node --no-source-maps", | ||
"dev": "parcel build --watch" | ||
"compile": "npm run build", | ||
"build": "parcel build ./src/google/index.ts --target node --no-minify", | ||
"dev": "parcel ./src/google/index.ts" | ||
}, | ||
@@ -24,3 +24,3 @@ "repository": { | ||
"places", | ||
"web" | ||
"node" | ||
], | ||
@@ -30,6 +30,8 @@ "author": "Miguel Caballero <mcabs3@gmail.com>", | ||
"devDependencies": { | ||
"jest": "^22.1.4", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.0.3", | ||
"parcel-bundler": "^1.9.7" | ||
"@types/superagent": "^4.1.1", | ||
"husky": "^1.3.1", | ||
"jest": "24.7.0", | ||
"parcel-bundler": "1.12.3", | ||
"tslint": "5.15.0", | ||
"typescript": "3.4.1" | ||
}, | ||
@@ -40,5 +42,4 @@ "files": [ | ||
"dependencies": { | ||
"axios": "^0.17.1", | ||
"query-string": "^5.0.1" | ||
"superagent": "^5.0.2" | ||
} | ||
} |
# Google Places Web | ||
A promise-based wrapper for the Google Places JS SDK for Node (and React Native). | ||
A promise-based wrapper for the Google Places JS SDK for Node. | ||
@@ -60,9 +60,12 @@ ## Installation | ||
type: [], // Undefined type will return all types | ||
rankby: "distance", // See google docs for different possible values | ||
}).then(result => { | ||
// result object | ||
rankby: "distance" // See google docs for different possible values | ||
}) | ||
.then(result => { | ||
// result object | ||
}) | ||
.catch(e => console.log(e)); | ||
``` | ||
## Full Example | ||
Make sure you have the lib built with `npm run build` or `yarn build`. That should create your `dist/` directory. | ||
@@ -76,2 +79,3 @@ | ||
## Troubleshooting | ||
Feel free to file issues as you see fit, and always looking for collaborators to help make this better. | ||
@@ -78,0 +82,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
34772
1
502
1
91
6
1
+ Addedsuperagent@^5.0.2
+ Addedasynckit@0.4.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcookiejar@2.1.4(transitive)
+ Addeddebug@4.3.4(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedform-data@3.0.1(transitive)
+ Addedformidable@1.2.6(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@2.6.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.1.2(transitive)
+ Addedobject-inspect@1.13.1(transitive)
+ Addedqs@6.12.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@7.6.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedsuperagent@5.3.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedaxios@^0.17.1
- Removedquery-string@^5.0.1
- Removedaxios@0.17.1(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removedfollow-redirects@1.15.6(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedquery-string@5.1.1(transitive)
- Removedstrict-uri-encode@1.1.0(transitive)