Named export for ol/asserts

This commit is contained in:
Frederic Junod
2017-12-17 18:10:59 +01:00
parent 7202573f82
commit 9349ba5403
33 changed files with 89 additions and 92 deletions

View File

@@ -2,7 +2,7 @@
* @module ol/structs/LRUCache
*/
import {inherits} from '../index.js';
import _ol_asserts_ from '../asserts.js';
import {assert} from '../asserts.js';
import EventTarget from '../events/EventTarget.js';
import EventType from '../events/EventType.js';
@@ -107,7 +107,7 @@ LRUCache.prototype.forEach = function(f, opt_this) {
*/
LRUCache.prototype.get = function(key) {
var entry = this.entries_[key];
_ol_asserts_.assert(entry !== undefined,
assert(entry !== undefined,
15); // Tried to get a value for a key that does not exist in the cache
if (entry === this.newest_) {
return entry.value_;
@@ -133,7 +133,7 @@ LRUCache.prototype.get = function(key) {
*/
LRUCache.prototype.remove = function(key) {
var entry = this.entries_[key];
_ol_asserts_.assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
assert(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
if (entry === this.newest_) {
this.newest_ = /** @type {ol.LRUCacheEntry} */ (entry.older);
if (this.newest_) {
@@ -248,7 +248,7 @@ LRUCache.prototype.replace = function(key, value) {
* @param {T} value Value.
*/
LRUCache.prototype.set = function(key, value) {
_ol_asserts_.assert(!(key in this.entries_),
assert(!(key in this.entries_),
16); // Tried to set a value for a key that is used already
var entry = /** @type {ol.LRUCacheEntry} */ ({
key_: key,

View File

@@ -1,7 +1,7 @@
/**
* @module ol/structs/PriorityQueue
*/
import _ol_asserts_ from '../asserts.js';
import {assert} from '../asserts.js';
import _ol_obj_ from '../obj.js';
/**
@@ -99,7 +99,7 @@ PriorityQueue.prototype.dequeue = function() {
* @return {boolean} The element was added to the queue.
*/
PriorityQueue.prototype.enqueue = function(element) {
_ol_asserts_.assert(!(this.keyFunction_(element) in this.queuedElements_),
assert(!(this.keyFunction_(element) in this.queuedElements_),
31); // Tried to enqueue an `element` that was already added to the queue
var priority = this.priorityFunction_(element);
if (priority != PriorityQueue.DROP) {