@xaendar/common 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/xaendar-common.es.d.ts
CHANGED
package/xaendar-common.es.js
CHANGED
package/xaendar-common.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xaendar-common.es.js","names":[],"sources":["../../../packages/common/src/models/stack/stack.model.ts"],"sourcesContent":["/**\r\n * A generic LIFO (Last In, First Out) stack data structure.\r\n *\r\n * @template T - The type of elements held in the stack. Defaults to `unknown`.\r\n */\r\nexport class Stack<T = unknown> {\r\n /**\r\n * Internal array holding the stack elements, ordered from bottom to top.\r\n */\r\n private _elements = new Array<T>;\r\n\r\n [index: number]: T;\r\n\r\n constructor() {\r\n return new Proxy(this, {\r\n get(target, prop) {\r\n
|
|
1
|
+
{"version":3,"file":"xaendar-common.es.js","names":[],"sources":["../../../packages/common/src/models/stack/stack.model.ts"],"sourcesContent":["/**\r\n * A generic LIFO (Last In, First Out) stack data structure.\r\n *\r\n * @template T - The type of elements held in the stack. Defaults to `unknown`.\r\n */\r\nexport class Stack<T = unknown> {\r\n /**\r\n * Internal array holding the stack elements, ordered from bottom to top.\r\n */\r\n private _elements = new Array<T>;\r\n\r\n [index: number]: T;\r\n\r\n [prop: string | symbol]: unknown;\r\n\r\n constructor() {\r\n return new Proxy(this, {\r\n get(target, prop) {\r\n return isNaN(Number(prop)) ? target[prop] : target._elements[Number(prop)];\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * The number of elements currently in the stack.\r\n */\r\n public get length(): number {\r\n return this._elements.length;\r\n }\r\n\r\n /**\r\n * A shallow copy of the elements in the stack, ordered from bottom to top.\r\n */\r\n public get values(): T[] {\r\n return [...this._elements];\r\n }\r\n\r\n /**\r\n * Removes and returns the top element of the stack.\r\n *\r\n * @returns The top element, or `undefined` if the stack is empty.\r\n */\r\n public pop(): T | undefined {\r\n return this._elements.pop();\r\n }\r\n\r\n /**\r\n * Pushes an element onto the top of the stack.\r\n *\r\n * @param element - The element to push.\r\n * @returns The new length of the stack.\r\n */\r\n public push(element: T): number {\r\n return this._elements.push(element);\r\n }\r\n}"],"mappings":";AAKA,IAAa,IAAb,MAAgC;CAI9B,YAAoB,EAAY;CAMhC,cAAc;EACZ,OAAO,IAAI,MAAM,MAAM,EACrB,IAAI,GAAQ,GAAM;GAChB,OAAO,MAAM,OAAO,EAAK,CAAC,GAAG,EAAO,KAAQ,EAAO,UAAU,OAAO,EAAK;KAE5E,CAAC;;CAMJ,IAAW,SAAiB;EAC1B,OAAO,KAAK,UAAU;;CAMxB,IAAW,SAAc;EACvB,OAAO,CAAC,GAAG,KAAK,UAAU;;CAQ5B,MAA4B;EAC1B,OAAO,KAAK,UAAU,KAAK;;CAS7B,KAAY,GAAoB;EAC9B,OAAO,KAAK,UAAU,KAAK,EAAQ"}
|