chore(jsdoc):Linting fixes (#3703)

* fixed the lockfile having a different version

* jsdoc
This commit is contained in:
Frank Elsinga 2023-09-07 09:42:44 +02:00 committed by GitHub
parent d243cd84bf
commit d6302198f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 117 additions and 54 deletions

View file

@ -1,20 +1,22 @@
/**
* An object that can be used as an array with a key
* Like PHP's array
* @template K
* @template V
*/
class ArrayWithKey {
/**
* All keys that are stored in the current object
* @type {K[]}
* @private
*/
__stack = [];
/**
*
*/
constructor() {
}
/**
* @param key
* @param value
* Push an element to the end of the array
* @param {K} key The key of the element
* @param {V} value The value of the element
* @returns {void}
*/
push(key, value) {
this[key] = value;
@ -22,7 +24,8 @@ class ArrayWithKey {
}
/**
*
* Get the last element and remove it from the array
* @returns {V|undefined} The first value, or undefined if there is no element to pop
*/
pop() {
let key = this.__stack.pop();
@ -32,7 +35,8 @@ class ArrayWithKey {
}
/**
*
* Get the last key
* @returns {K|null} The last key, or null if the array is empty
*/
getLastKey() {
if (this.__stack.length === 0) {
@ -42,7 +46,8 @@ class ArrayWithKey {
}
/**
*
* Get the first element
* @returns {{key:K,value:V}|null} The first element, or null if the array is empty
*/
shift() {
let key = this.__stack.shift();
@ -55,15 +60,16 @@ class ArrayWithKey {
}
/**
*
* Get the length of the array
* @returns {number} Amount of elements stored
*/
length() {
return this.__stack.length;
}
/**
* Get the last element
* @returns {*|null} The last element, or null if the array is empty
* Get the last value
* @returns {V|null} The last element without removing it, or null if the array is empty
*/
last() {
let key = this.getLastKey();