@goodware/log
Advanced tools
Comparing version 8.0.5 to 8.0.6
# @goodware/log Release History | ||
## 8.0.6 2022-07-04 | ||
Update documentation | ||
## 8.0.5 2022-06-26 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "@goodware/log", | ||
"version": "8.0.5", | ||
"version": "8.0.6", | ||
"description": "Batteries-included Winston3-based loggger with console, file, and AWS CloudWatch Logs transports", | ||
@@ -5,0 +5,0 @@ "author": "devguy@devguy.com", |
17
Stack.js
@@ -13,3 +13,3 @@ /** | ||
/** | ||
* Removes all items | ||
* Removes all items. This is the same as `pop(0)`. | ||
*/ | ||
@@ -21,4 +21,5 @@ clear() { | ||
/** | ||
* @property {number} | ||
* Returns the number of items in the stack | ||
* @returns {number} | ||
* @type {number} | ||
*/ | ||
@@ -40,12 +41,12 @@ get length() { | ||
* Removes items from the top of the stack | ||
* @param {number} [to] If negative, remove the item at the top of the stack only. Otherwise, remove items from the | ||
* top of the stack until its length is equal to the specified value. | ||
* @param {number} [toLength] If negative, remove the item at the top of the stack only. Otherwise, remove items from | ||
* the top of the stack until its length is equal to the specified value. | ||
* @returns {*} The last item removed from the stack | ||
*/ | ||
pop(to = -1) { | ||
pop(toLength = -1) { | ||
const { stack } = this; | ||
if (!stack.length) throw new Error('out of range'); | ||
if (to < 0) return stack.pop(); | ||
if (to >= stack.length) throw new Error('out of range'); | ||
return stack.splice(to)[0]; | ||
if (toLength < 0) return stack.pop(); | ||
if (toLength >= stack.length) throw new Error('out of range'); | ||
return stack.splice(toLength)[0]; | ||
} | ||
@@ -52,0 +53,0 @@ |
Sorry, the diff of this file is too big to display
138759
2756