@sapphire-sh/utils 1.22.0 → 1.23.0
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/lib/isNonNullable.d.ts +1 -1
- package/lib/logger.d.ts +1 -1
- package/lib/logger.js +1 -1
- package/lib/queue.d.ts +1 -1
- package/lib/queue.js +7 -8
- package/package.json +2 -2
package/lib/isNonNullable.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isNonNullable: <T extends object>(value?: T | null
|
|
1
|
+
export declare const isNonNullable: <T extends object>(value?: T | null) => value is NonNullable<T>;
|
package/lib/logger.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare enum LogLevel {
|
|
|
4
4
|
WARN = 3,
|
|
5
5
|
ERROR = 4
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
type Payload = Record<string, unknown> | Error;
|
|
8
8
|
export declare const logger: {
|
|
9
9
|
debug: (message: string, payload?: Payload) => void;
|
|
10
10
|
info: (message: string, payload?: Payload) => void;
|
package/lib/logger.js
CHANGED
|
@@ -7,7 +7,7 @@ var LogLevel;
|
|
|
7
7
|
LogLevel[LogLevel["INFO"] = 2] = "INFO";
|
|
8
8
|
LogLevel[LogLevel["WARN"] = 3] = "WARN";
|
|
9
9
|
LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
|
|
10
|
-
})(LogLevel
|
|
10
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
11
11
|
function serializePayload(payload) {
|
|
12
12
|
const json = JSON.stringify(payload instanceof Error ? { error: payload.message, name: payload.name, stack: payload.stack } : payload);
|
|
13
13
|
return json.padStart(json.length + 1);
|
package/lib/queue.d.ts
CHANGED
package/lib/queue.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Queue = void 0;
|
|
4
4
|
class QueueNode {
|
|
5
|
+
value;
|
|
6
|
+
_next = null;
|
|
5
7
|
constructor(value) {
|
|
6
8
|
this.value = value;
|
|
7
|
-
this._next = null;
|
|
8
9
|
}
|
|
9
10
|
get next() {
|
|
10
11
|
return this._next;
|
|
@@ -14,11 +15,10 @@ class QueueNode {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
class Queue {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
head = null;
|
|
19
|
+
tail = null;
|
|
20
|
+
_size = 0;
|
|
21
|
+
constructor() { }
|
|
22
22
|
enqueue(value) {
|
|
23
23
|
const newNode = new QueueNode(value);
|
|
24
24
|
if (this.isEmpty() || !this.tail) {
|
|
@@ -61,8 +61,7 @@ class Queue {
|
|
|
61
61
|
return this._size === 0;
|
|
62
62
|
}
|
|
63
63
|
peek() {
|
|
64
|
-
|
|
65
|
-
return (_a = this.head) === null || _a === void 0 ? void 0 : _a.value;
|
|
64
|
+
return this.head?.value;
|
|
66
65
|
}
|
|
67
66
|
has(value) {
|
|
68
67
|
let node = this.head;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire-sh/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "@sapphire-sh/utils",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"prettier": "^3.8.1",
|
|
31
31
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
32
|
-
"typescript": "^
|
|
32
|
+
"typescript": "^5.9.3"
|
|
33
33
|
}
|
|
34
34
|
}
|