@sapphire-sh/utils 1.22.0 → 1.24.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/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
  [![license](https://img.shields.io/github/license/sapphire-sh/sapphire-utils)](https://github.com/sapphire-sh/sapphire-utils/blob/main/LICENSE)
5
5
  [![npm package version](https://img.shields.io/npm/v/@sapphire-sh/utils)](https://www.npmjs.com/package/@sapphire-sh/utils)
6
6
  [![github package version](https://img.shields.io/github/package-json/v/sapphire-sh/sapphire-utils?label=github)](https://github.com/sapphire-sh/sapphire-utils/packages/1601820)
7
- [![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@sapphire-sh/utils)](https://bundlephobia.com/package/@sapphire-sh/utils@1.4.0)
7
+ [![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@sapphire-sh/utils)](https://bundlephobia.com/package/@sapphire-sh/utils)
8
8
 
9
- # usage
9
+ ## Installation
10
10
 
11
11
  ```sh
12
12
  npm install -S @sapphire-sh/utils
@@ -1 +1 @@
1
- export declare const isNonNullable: <T extends object>(value?: T | null | undefined) => value is NonNullable<T>;
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
- declare type Payload = Record<string, unknown> | Error;
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 = exports.LogLevel || (exports.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
@@ -1,4 +1,4 @@
1
- declare type Value = object | number | string | boolean;
1
+ type Value = object | number | string | boolean;
2
2
  export declare class Queue<T extends Value> {
3
3
  private head;
4
4
  private tail;
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
- constructor() {
18
- this.head = null;
19
- this.tail = null;
20
- this._size = 0;
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
- var _a;
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.22.0",
3
+ "version": "1.24.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": "^4.7.4"
32
+ "typescript": "^5.9.3"
33
33
  }
34
34
  }