diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2022-05-20 10:28:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 10:28:38 -0400 |
commit | 31e20c889e467aa4ba64b0b5baf602adc1359371 (patch) | |
tree | a033db935a817b2d407ec20843176610a87a6e16 /ext/js/general/cache-map.js | |
parent | ae0ad227c0fd293609a21e5cc1d2a4b85fe7c520 (diff) |
ESlint JSdoc (#2148)
* Install eslint-plugin-jsdoc
* Initial rules setup
* Update lists
* Use @returns rather than @return
* Remove error throwing code which is never executed
* Fix issues relating to @throws
* General error fixes
* Update Display type documentation
* Various doc fixes
* Fix invalid tuple syntax
* Doc updates
* Remove unused
* Doc updates
* Enable jsdoc/require-returns
* Update rules
* Update remaining rules
Diffstat (limited to 'ext/js/general/cache-map.js')
-rw-r--r-- | ext/js/general/cache-map.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/js/general/cache-map.js b/ext/js/general/cache-map.js index f993cc26..fccb7cdd 100644 --- a/ext/js/general/cache-map.js +++ b/ext/js/general/cache-map.js @@ -21,7 +21,7 @@ class CacheMap { /** * Creates a new CacheMap. - * @param maxSize The maximum number of entries able to be stored in the cache. + * @param {number} maxSize The maximum number of entries able to be stored in the cache. */ constructor(maxSize) { if (!( @@ -42,6 +42,7 @@ class CacheMap { /** * Returns the number of items in the cache. + * @type {number} */ get size() { return this._map.size; @@ -49,6 +50,7 @@ class CacheMap { /** * Returns the maximum number of items that can be added to the cache. + * @type {number} */ get maxSize() { return this._maxSize; @@ -56,8 +58,8 @@ class CacheMap { /** * Returns whether or not an element exists at the given key. - * @param key The key of the element. - * @returns `true` if an element with the specified key exists, `false` otherwise. + * @param {*} key The key of the element. + * @returns {boolean} `true` if an element with the specified key exists, `false` otherwise. */ has(key) { return this._map.has(key); @@ -65,8 +67,8 @@ class CacheMap { /** * Gets an element at the given key, if it exists. Otherwise, returns undefined. - * @param key The key of the element. - * @returns The existing value at the key, if any; `undefined` otherwise. + * @param {*} key The key of the element. + * @returns {*} The existing value at the key, if any; `undefined` otherwise. */ get(key) { const node = this._map.get(key); @@ -77,8 +79,8 @@ class CacheMap { /** * Sets a value at a given key. - * @param key The key of the element. - * @param value The value to store in the cache. + * @param {*} key The key of the element. + * @param {*} value The value to store in the cache. */ set(key, value) { let node = this._map.get(key); |