UNPKG

georedis-promised

Version:

Super fast promisified geo queries.

40 lines 1.54 kB
"use strict"; var __spreadArrays = (this && this.__spreadArrays) || function () { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; exports.__esModule = true; exports.initialize = void 0; var georedis_1 = require("georedis"); var initialize = function (client) { var _geo = georedis_1.initialize(client); var exec = function (fn, args) { if (args === void 0) { args = []; } return new Promise(function (resolve, reject) { fn.apply(void 0, __spreadArrays(args, [ function (err, result) { if (err) { reject(err); return; } resolve(result); }, ])); }); }; return { "delete": function () { return exec(_geo["delete"].bind(_geo)); }, removeLocations: function (locationNames) { return exec(_geo.removeLocations.bind(_geo), [locationNames]); }, addLocation: function (locationName, position) { return exec(_geo.addLocation.bind(_geo), [locationName, position]); }, nearby: function (locationName, radius, options) { return exec(_geo.nearby.bind(_geo), [locationName, radius, options]); } }; }; exports.initialize = initialize; //# sourceMappingURL=index.js.map