UNPKG

distance-matrix-2

Version:

Node.js wrapper for Goople Distance Matrix API.

20 lines (19 loc) 602 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DistanceMatrixService = void 0; const common_1 = require("./common"); class DistanceMatrixService { constructor(key) { this.key = key; } setKey(key) { this.key = key; } getDistanceMatrix(options) { if (!this.key) throw new Error("There's no API key."); const query = (0, common_1.stringifyQueryParams)(options, this.key); return (0, common_1.requestJson)(common_1.baseUrl + query); } } exports.DistanceMatrixService = DistanceMatrixService;