UNPKG

tchen-vuelayers

Version:

Web map Vue components with the power of OpenLayers

178 lines (155 loc) 4.15 kB
/** * VueLayers * Web map Vue components with the power of OpenLayers * * @package vuelayers * @author Vladimir Vershinin <ghettovoice@gmail.com> * @version 0.11.1 * @license MIT * @copyright (c) 2017-2019, Vladimir Vershinin <ghettovoice@gmail.com> */ import _classCallCheck from '@babel/runtime-corejs2/helpers/esm/classCallCheck'; import _possibleConstructorReturn from '@babel/runtime-corejs2/helpers/esm/possibleConstructorReturn'; import _getPrototypeOf from '@babel/runtime-corejs2/helpers/esm/getPrototypeOf'; import _inherits from '@babel/runtime-corejs2/helpers/esm/inherits'; import _assertThisInitialized from '@babel/runtime-corejs2/helpers/esm/assertThisInitialized'; import _wrapNativeSuper from '@babel/runtime-corejs2/helpers/esm/wrapNativeSuper'; import { isNumeric } from './minilo'; var AssertionError = /*#__PURE__*/ function (_Error) { _inherits(AssertionError, _Error); function AssertionError(message) { var _this; _classCallCheck(this, AssertionError); _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, message)); _this.name = _this.constructor.name; if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), _this.constructor); } else { _this.stack = new Error(message).stack; } return _this; } return AssertionError; }(_wrapNativeSuper(Error)); /** * @param {*} value * @param {string} message * @throws AssertionError */ function assert(value, message) { if (!value) { throw new AssertionError(message || "Assertion failed"); } } /** * Alias of `assert` function. * @param value * @param message */ function ok(value, message) { return assert(value, message); } /** * @param {*} value * @throws {AssertionError} */ function numeric(value) { assert(isNumeric(value), 'value is a number'); } /** * @param {*} value * @param {Function} Ctor * @throws {AssertionError} */ function instanceOf(value, Ctor) { assert(value instanceof Ctor, "value is an instance of ".concat(Ctor.name)); } function hasOlObject(vm) { assert(vm.$olObject, 'component has "$olObject" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasMap(vm) { assert(vm.$map, 'component has "$map" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasView(vm) { assert(vm.$view, 'component has "$view" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasGeolocation(vm) { assert(vm.$geolocation, 'component has "$geolocation" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasFeature(vm) { assert(vm.$feature, 'component has "$feature" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasLayer(vm) { assert(vm.$layer, 'component has "$layer" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasSource(vm) { assert(vm.$source, 'component has "$source" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasGeometry(vm) { assert(vm.$geometry, 'component has "$geometry" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasInteraction(vm) { assert(vm.$interaction, 'component has "$interaction" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasStyle(vm) { assert(vm.$style, 'component has "$style" property'); } /** * @param {Object} vm * @return {void} * @throws {AssertionError} */ function hasOverlay(vm) { assert(vm.$overlay, 'component has "$overlay" property'); } function hasGraticule(vm) { assert(vm.$graticule, 'component has "$graticule" property'); } export { AssertionError, assert, ok, numeric, instanceOf, hasOlObject, hasMap, hasView, hasGeolocation, hasFeature, hasLayer, hasSource, hasGeometry, hasInteraction, hasStyle, hasOverlay, hasGraticule };