UNPKG

@iotize/device-client.js

Version:

IoTize Device client for Javascript

27 lines (26 loc) 767 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Path alias resolver. * Provide mapping between url and */ var AliasResolver = /** @class */ (function () { function AliasResolver(map) { this._map = map ? map : {}; } AliasResolver.prototype.add = function (key, value) { this._map[key] = value; return this; }; AliasResolver.prototype.resolve = function (key) { if (!this.has(key)) { throw new Error('Missing path from ' + key); } return this._map[key]; }; AliasResolver.prototype.has = function (key) { return (key in this._map); }; return AliasResolver; }()); exports.AliasResolver = AliasResolver;