Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
79
node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
79
node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class PriorityQueue<T> extends Base {
|
||||
/**
|
||||
* @description PriorityQueue's constructor.
|
||||
* @param container - Initialize container, must have a forEach function.
|
||||
* @param cmp - Compare function.
|
||||
* @param copy - When the container is an array, you can choose to directly operate on the original object of
|
||||
* the array or perform a shallow copy. The default is shallow copy.
|
||||
* @example
|
||||
* new PriorityQueue();
|
||||
* new PriorityQueue([1, 2, 3]);
|
||||
* new PriorityQueue([1, 2, 3], (x, y) => x - y);
|
||||
* new PriorityQueue([1, 2, 3], (x, y) => x - y, false);
|
||||
*/
|
||||
constructor(container?: initContainer<T>, cmp?: (x: T, y: T) => number, copy?: boolean);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Push element into a container in order.
|
||||
* @param item - The element you want to push.
|
||||
* @returns The size of heap after pushing.
|
||||
* @example
|
||||
* queue.push(1);
|
||||
*/
|
||||
push(item: T): void;
|
||||
/**
|
||||
* @description Removes the top element.
|
||||
* @returns The element you popped.
|
||||
* @example
|
||||
* queue.pop();
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* @description Accesses the top element.
|
||||
* @example
|
||||
* const top = queue.top();
|
||||
*/
|
||||
top(): T | undefined;
|
||||
/**
|
||||
* @description Check if element is in heap.
|
||||
* @param item - The item want to find.
|
||||
* @returns Whether element is in heap.
|
||||
* @example
|
||||
* const que = new PriorityQueue([], (x, y) => x.id - y.id);
|
||||
* const obj = { id: 1 };
|
||||
* que.push(obj);
|
||||
* console.log(que.find(obj)); // true
|
||||
*/
|
||||
find(item: T): boolean;
|
||||
/**
|
||||
* @description Remove specified item from heap.
|
||||
* @param item - The item want to remove.
|
||||
* @returns Whether remove success.
|
||||
* @example
|
||||
* const que = new PriorityQueue([], (x, y) => x.id - y.id);
|
||||
* const obj = { id: 1 };
|
||||
* que.push(obj);
|
||||
* que.remove(obj);
|
||||
*/
|
||||
remove(item: T): boolean;
|
||||
/**
|
||||
* @description Update item and it's pos in the heap.
|
||||
* @param item - The item want to update.
|
||||
* @returns Whether update success.
|
||||
* @example
|
||||
* const que = new PriorityQueue([], (x, y) => x.id - y.id);
|
||||
* const obj = { id: 1 };
|
||||
* que.push(obj);
|
||||
* obj.id = 2;
|
||||
* que.updateItem(obj);
|
||||
*/
|
||||
updateItem(item: T): boolean;
|
||||
/**
|
||||
* @returns Return a copy array of heap.
|
||||
* @example
|
||||
* const arr = queue.toArray();
|
||||
*/
|
||||
toArray(): T[];
|
||||
}
|
||||
export default PriorityQueue;
|
||||
171
node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
171
node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js
generated
vendored
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(i, r) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(i, r) {
|
||||
i.__proto__ = r;
|
||||
} || function(i, r) {
|
||||
for (var t in r) if (Object.prototype.hasOwnProperty.call(r, t)) i[t] = r[t];
|
||||
};
|
||||
return extendStatics(i, r);
|
||||
};
|
||||
return function(i, r) {
|
||||
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
||||
extendStatics(i, r);
|
||||
function __() {
|
||||
this.constructor = i;
|
||||
}
|
||||
i.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
var __read = this && this.P || function(i, r) {
|
||||
var t = typeof Symbol === "function" && i[Symbol.iterator];
|
||||
if (!t) return i;
|
||||
var e = t.call(i), n, u = [], s;
|
||||
try {
|
||||
while ((r === void 0 || r-- > 0) && !(n = e.next()).done) u.push(n.value);
|
||||
} catch (i) {
|
||||
s = {
|
||||
error: i
|
||||
};
|
||||
} finally {
|
||||
try {
|
||||
if (n && !n.done && (t = e["return"])) t.call(e);
|
||||
} finally {
|
||||
if (s) throw s.error;
|
||||
}
|
||||
}
|
||||
return u;
|
||||
};
|
||||
|
||||
var __spreadArray = this && this.A || function(i, r, t) {
|
||||
if (t || arguments.length === 2) for (var e = 0, n = r.length, u; e < n; e++) {
|
||||
if (u || !(e in r)) {
|
||||
if (!u) u = Array.prototype.slice.call(r, 0, e);
|
||||
u[e] = r[e];
|
||||
}
|
||||
}
|
||||
return i.concat(u || Array.prototype.slice.call(r));
|
||||
};
|
||||
|
||||
import { Base } from "../ContainerBase";
|
||||
|
||||
var PriorityQueue = function(i) {
|
||||
__extends(PriorityQueue, i);
|
||||
function PriorityQueue(r, t, e) {
|
||||
if (r === void 0) {
|
||||
r = [];
|
||||
}
|
||||
if (t === void 0) {
|
||||
t = function(i, r) {
|
||||
if (i > r) return -1;
|
||||
if (i < r) return 1;
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
if (e === void 0) {
|
||||
e = true;
|
||||
}
|
||||
var n = i.call(this) || this;
|
||||
n.j = t;
|
||||
if (Array.isArray(r)) {
|
||||
n.B = e ? __spreadArray([], __read(r), false) : r;
|
||||
} else {
|
||||
n.B = [];
|
||||
var u = n;
|
||||
r.forEach((function(i) {
|
||||
u.B.push(i);
|
||||
}));
|
||||
}
|
||||
n.i = n.B.length;
|
||||
var s = n.i >> 1;
|
||||
for (var o = n.i - 1 >> 1; o >= 0; --o) {
|
||||
n.O(o, s);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
PriorityQueue.prototype.S = function(i) {
|
||||
var r = this.B[i];
|
||||
while (i > 0) {
|
||||
var t = i - 1 >> 1;
|
||||
var e = this.B[t];
|
||||
if (this.j(e, r) <= 0) break;
|
||||
this.B[i] = e;
|
||||
i = t;
|
||||
}
|
||||
this.B[i] = r;
|
||||
};
|
||||
PriorityQueue.prototype.O = function(i, r) {
|
||||
var t = this.B[i];
|
||||
while (i < r) {
|
||||
var e = i << 1 | 1;
|
||||
var n = e + 1;
|
||||
var u = this.B[e];
|
||||
if (n < this.i && this.j(u, this.B[n]) > 0) {
|
||||
e = n;
|
||||
u = this.B[n];
|
||||
}
|
||||
if (this.j(u, t) >= 0) break;
|
||||
this.B[i] = u;
|
||||
i = e;
|
||||
}
|
||||
this.B[i] = t;
|
||||
};
|
||||
PriorityQueue.prototype.clear = function() {
|
||||
this.i = 0;
|
||||
this.B.length = 0;
|
||||
};
|
||||
PriorityQueue.prototype.push = function(i) {
|
||||
this.B.push(i);
|
||||
this.S(this.i);
|
||||
this.i += 1;
|
||||
};
|
||||
PriorityQueue.prototype.pop = function() {
|
||||
if (this.i === 0) return;
|
||||
var i = this.B[0];
|
||||
var r = this.B.pop();
|
||||
this.i -= 1;
|
||||
if (this.i) {
|
||||
this.B[0] = r;
|
||||
this.O(0, this.i >> 1);
|
||||
}
|
||||
return i;
|
||||
};
|
||||
PriorityQueue.prototype.top = function() {
|
||||
return this.B[0];
|
||||
};
|
||||
PriorityQueue.prototype.find = function(i) {
|
||||
return this.B.indexOf(i) >= 0;
|
||||
};
|
||||
PriorityQueue.prototype.remove = function(i) {
|
||||
var r = this.B.indexOf(i);
|
||||
if (r < 0) return false;
|
||||
if (r === 0) {
|
||||
this.pop();
|
||||
} else if (r === this.i - 1) {
|
||||
this.B.pop();
|
||||
this.i -= 1;
|
||||
} else {
|
||||
this.B.splice(r, 1, this.B.pop());
|
||||
this.i -= 1;
|
||||
this.S(r);
|
||||
this.O(r, this.i >> 1);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
PriorityQueue.prototype.updateItem = function(i) {
|
||||
var r = this.B.indexOf(i);
|
||||
if (r < 0) return false;
|
||||
this.S(r);
|
||||
this.O(r, this.i >> 1);
|
||||
return true;
|
||||
};
|
||||
PriorityQueue.prototype.toArray = function() {
|
||||
return __spreadArray([], __read(this.B), false);
|
||||
};
|
||||
return PriorityQueue;
|
||||
}(Base);
|
||||
|
||||
export default PriorityQueue;
|
||||
//# sourceMappingURL=PriorityQueue.js.map
|
||||
1
node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/esm/container/OtherContainer/PriorityQueue.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
22
node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class Queue<T> extends Base {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Inserts element to queue's end.
|
||||
* @param element - The element you want to push to the front.
|
||||
* @returns The container length after pushing.
|
||||
*/
|
||||
push(element: T): number;
|
||||
/**
|
||||
* @description Removes the first element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* @description Access the first element.
|
||||
* @returns The first element.
|
||||
*/
|
||||
front(): T | undefined;
|
||||
}
|
||||
export default Queue;
|
||||
58
node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js
generated
vendored
Normal file
58
node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(e, t) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(e, t) {
|
||||
e.__proto__ = t;
|
||||
} || function(e, t) {
|
||||
for (var n in t) if (Object.prototype.hasOwnProperty.call(t, n)) e[n] = t[n];
|
||||
};
|
||||
return extendStatics(e, t);
|
||||
};
|
||||
return function(e, t) {
|
||||
if (typeof t !== "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
||||
extendStatics(e, t);
|
||||
function __() {
|
||||
this.constructor = e;
|
||||
}
|
||||
e.prototype = t === null ? Object.create(t) : (__.prototype = t.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
import { Base } from "../ContainerBase";
|
||||
|
||||
import Deque from "../SequentialContainer/Deque";
|
||||
|
||||
var Queue = function(e) {
|
||||
__extends(Queue, e);
|
||||
function Queue(t) {
|
||||
if (t === void 0) {
|
||||
t = [];
|
||||
}
|
||||
var n = e.call(this) || this;
|
||||
n.q = new Deque(t);
|
||||
n.i = n.q.size();
|
||||
return n;
|
||||
}
|
||||
Queue.prototype.clear = function() {
|
||||
this.q.clear();
|
||||
this.i = 0;
|
||||
};
|
||||
Queue.prototype.push = function(e) {
|
||||
this.q.pushBack(e);
|
||||
this.i += 1;
|
||||
return this.i;
|
||||
};
|
||||
Queue.prototype.pop = function() {
|
||||
if (this.i === 0) return;
|
||||
this.i -= 1;
|
||||
return this.q.popFront();
|
||||
};
|
||||
Queue.prototype.front = function() {
|
||||
return this.q.front();
|
||||
};
|
||||
return Queue;
|
||||
}(Base);
|
||||
|
||||
export default Queue;
|
||||
//# sourceMappingURL=Queue.js.map
|
||||
1
node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/esm/container/OtherContainer/Queue.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["container/OtherContainer/Queue.js","../../src/container/OtherContainer/Queue.ts"],"names":["__extends","this","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","TypeError","String","__","constructor","create","Base","Deque","Queue","_super","container","_this","_queue","_length","size","clear","push","element","pushBack","pop","popFront","front"],"mappings":"AAAA,IAAIA,YAAaC,QAAQA,KAAKD,KAAe;IACzC,I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B,EAAOS;ADenB;ICbJ,OAAAb;AAAA,CAxCA,CAAuBF;;eA0CRE","file":"Queue.js","sourcesContent":["var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { Base } from \"../ContainerBase\";\nimport Deque from \"../SequentialContainer/Deque\";\nvar Queue = /** @class */ (function (_super) {\n __extends(Queue, _super);\n function Queue(container) {\n if (container === void 0) { container = []; }\n var _this = _super.call(this) || this;\n _this._queue = new Deque(container);\n _this._length = _this._queue.size();\n return _this;\n }\n Queue.prototype.clear = function () {\n this._queue.clear();\n this._length = 0;\n };\n /**\n * @description Inserts element to queue's end.\n * @param element - The element you want to push to the front.\n * @returns The container length after pushing.\n */\n Queue.prototype.push = function (element) {\n this._queue.pushBack(element);\n this._length += 1;\n return this._length;\n };\n /**\n * @description Removes the first element.\n * @returns The element you popped.\n */\n Queue.prototype.pop = function () {\n if (this._length === 0)\n return;\n this._length -= 1;\n return this._queue.popFront();\n };\n /**\n * @description Access the first element.\n * @returns The first element.\n */\n Queue.prototype.front = function () {\n return this._queue.front();\n };\n return Queue;\n}(Base));\nexport default Queue;\n","import { Base, initContainer } from '@/container/ContainerBase';\nimport Deque from '@/container/SequentialContainer/Deque';\n\nclass Queue<T> extends Base {\n /**\n * @internal\n */\n private _queue: Deque<T>;\n constructor(container: initContainer<T> = []) {\n super();\n this._queue = new Deque(container);\n this._length = this._queue.size();\n }\n clear() {\n this._queue.clear();\n this._length = 0;\n }\n /**\n * @description Inserts element to queue's end.\n * @param element - The element you want to push to the front.\n * @returns The container length after pushing.\n */\n push(element: T) {\n this._queue.pushBack(element);\n this._length += 1;\n return this._length;\n }\n /**\n * @description Removes the first element.\n * @returns The element you popped.\n */\n pop() {\n if (this._length === 0) return;\n this._length -= 1;\n return this._queue.popFront();\n }\n /**\n * @description Access the first element.\n * @returns The first element.\n */\n front() {\n return this._queue.front();\n }\n}\n\nexport default Queue;\n"]}
|
||||
22
node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
22
node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Base, initContainer } from "../ContainerBase";
|
||||
declare class Stack<T> extends Base {
|
||||
constructor(container?: initContainer<T>);
|
||||
clear(): void;
|
||||
/**
|
||||
* @description Insert element to stack's end.
|
||||
* @description The element you want to push to the back.
|
||||
* @returns The container length after erasing.
|
||||
*/
|
||||
push(element: T): number;
|
||||
/**
|
||||
* @description Removes the end element.
|
||||
* @returns The element you popped.
|
||||
*/
|
||||
pop(): T | undefined;
|
||||
/**
|
||||
* @description Accesses the end element.
|
||||
* @returns The last element.
|
||||
*/
|
||||
top(): T | undefined;
|
||||
}
|
||||
export default Stack;
|
||||
59
node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js
generated
vendored
Normal file
59
node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
var __extends = this && this.t || function() {
|
||||
var extendStatics = function(t, n) {
|
||||
extendStatics = Object.setPrototypeOf || {
|
||||
__proto__: []
|
||||
} instanceof Array && function(t, n) {
|
||||
t.__proto__ = n;
|
||||
} || function(t, n) {
|
||||
for (var i in n) if (Object.prototype.hasOwnProperty.call(n, i)) t[i] = n[i];
|
||||
};
|
||||
return extendStatics(t, n);
|
||||
};
|
||||
return function(t, n) {
|
||||
if (typeof n !== "function" && n !== null) throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
|
||||
extendStatics(t, n);
|
||||
function __() {
|
||||
this.constructor = t;
|
||||
}
|
||||
t.prototype = n === null ? Object.create(n) : (__.prototype = n.prototype, new __);
|
||||
};
|
||||
}();
|
||||
|
||||
import { Base } from "../ContainerBase";
|
||||
|
||||
var Stack = function(t) {
|
||||
__extends(Stack, t);
|
||||
function Stack(n) {
|
||||
if (n === void 0) {
|
||||
n = [];
|
||||
}
|
||||
var i = t.call(this) || this;
|
||||
i.k = [];
|
||||
var r = i;
|
||||
n.forEach((function(t) {
|
||||
r.push(t);
|
||||
}));
|
||||
return i;
|
||||
}
|
||||
Stack.prototype.clear = function() {
|
||||
this.i = 0;
|
||||
this.k = [];
|
||||
};
|
||||
Stack.prototype.push = function(t) {
|
||||
this.k.push(t);
|
||||
this.i += 1;
|
||||
return this.i;
|
||||
};
|
||||
Stack.prototype.pop = function() {
|
||||
if (this.i === 0) return;
|
||||
this.i -= 1;
|
||||
return this.k.pop();
|
||||
};
|
||||
Stack.prototype.top = function() {
|
||||
return this.k[this.i - 1];
|
||||
};
|
||||
return Stack;
|
||||
}(Base);
|
||||
|
||||
export default Stack;
|
||||
//# sourceMappingURL=Stack.js.map
|
||||
1
node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js.map
generated
vendored
Normal file
1
node_modules/js-sdsl/dist/esm/container/OtherContainer/Stack.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["container/OtherContainer/Stack.js","../../src/container/OtherContainer/Stack.ts"],"names":["__extends","this","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","TypeError","String","__","constructor","create","Base","Stack","_super","container","_this","_stack","self","forEach","el","push","clear","_length","element","pop","top"],"mappings":"AAAA,IAAIA,YAAaC,QAAQA,KAAKD,KAAe;IACzC,IAAIE,gBAAgB,SAAUC,GAAGC;QAC7BF,gBAAgBG,OAAOC,kBAClB;YAAEC,W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AAAA,CA1CA,CAAuBD;;eA4CRC","file":"Stack.js","sourcesContent":["var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport { Base } from \"../ContainerBase\";\nvar Stack = /** @class */ (function (_super) {\n __extends(Stack, _super);\n function Stack(container) {\n if (container === void 0) { container = []; }\n var _this = _super.call(this) || this;\n /**\n * @internal\n */\n _this._stack = [];\n var self = _this;\n container.forEach(function (el) {\n self.push(el);\n });\n return _this;\n }\n Stack.prototype.clear = function () {\n this._length = 0;\n this._stack = [];\n };\n /**\n * @description Insert element to stack's end.\n * @description The element you want to push to the back.\n * @returns The container length after erasing.\n */\n Stack.prototype.push = function (element) {\n this._stack.push(element);\n this._length += 1;\n return this._length;\n };\n /**\n * @description Removes the end element.\n * @returns The element you popped.\n */\n Stack.prototype.pop = function () {\n if (this._length === 0)\n return;\n this._length -= 1;\n return this._stack.pop();\n };\n /**\n * @description Accesses the end element.\n * @returns The last element.\n */\n Stack.prototype.top = function () {\n return this._stack[this._length - 1];\n };\n return Stack;\n}(Base));\nexport default Stack;\n","import { Base, initContainer } from '@/container/ContainerBase';\n\nclass Stack<T> extends Base {\n /**\n * @internal\n */\n private _stack: T[] = [];\n constructor(container: initContainer<T> = []) {\n super();\n const self = this;\n container.forEach(function (el) {\n self.push(el);\n });\n }\n clear() {\n this._length = 0;\n this._stack = [];\n }\n /**\n * @description Insert element to stack's end.\n * @description The element you want to push to the back.\n * @returns The container length after erasing.\n */\n push(element: T) {\n this._stack.push(element);\n this._length += 1;\n return this._length;\n }\n /**\n * @description Removes the end element.\n * @returns The element you popped.\n */\n pop() {\n if (this._length === 0) return;\n this._length -= 1;\n return this._stack.pop();\n }\n /**\n * @description Accesses the end element.\n * @returns The last element.\n */\n top(): T | undefined {\n return this._stack[this._length - 1];\n }\n}\n\nexport default Stack;\n"]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue