@softsky/utils 2.8.0 → 2.8.1

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
@@ -301,7 +301,7 @@ Returns a target and map of parents.
301
301
  You can use `unfoldPathfindingResult()` to get array of nodes.
302
302
 
303
303
  ---
304
- __function__ `dijkstra` - Dijkstra search. Like bfs but supports weight and target is required.
304
+ __function__ `dijkstra` - Dijkstra search. Like bfs but supports weight.
305
305
  If isTarget is omitted becomes floodfill (WITH WEIGHT).
306
306
  Returns a target and map of parents.
307
307
  You can use `unfoldPathfindingResult()` to get array of nodes.
@@ -622,3 +622,11 @@ b: "b";
622
622
  ```
623
623
 
624
624
  ---
625
+ __type__ `Tuple` - Create a tuple of size.
626
+
627
+ ```ts
628
+ type a = Tuple<number, 3>
629
+ type b = [number, number, number]
630
+ ```
631
+
632
+ ---
package/dist/graphs.d.ts CHANGED
@@ -60,7 +60,7 @@ export declare function dfs<T>(options: {
60
60
  target?: T;
61
61
  };
62
62
  /**
63
- * Dijkstra search. Like bfs but supports weight and target is required.
63
+ * Dijkstra search. Like bfs but supports weight.
64
64
  * If isTarget is omitted becomes floodfill (WITH WEIGHT).
65
65
  * Returns a target and map of parents.
66
66
  * You can use `unfoldPathfindingResult()` to get array of nodes.
package/dist/graphs.js CHANGED
@@ -110,7 +110,7 @@ export function dfs(options) {
110
110
  };
111
111
  }
112
112
  /**
113
- * Dijkstra search. Like bfs but supports weight and target is required.
113
+ * Dijkstra search. Like bfs but supports weight.
114
114
  * If isTarget is omitted becomes floodfill (WITH WEIGHT).
115
115
  * Returns a target and map of parents.
116
116
  * You can use `unfoldPathfindingResult()` to get array of nodes.
package/dist/types.d.ts CHANGED
@@ -8,9 +8,9 @@ export type AnyFunction = (...data: any[]) => any;
8
8
  /** Values that convert to false */
9
9
  export type Falsy = false | '' | 0 | null | undefined;
10
10
  /** Make keys in object optional */
11
- export type Optional<T, K extends keyof T> = Omit<T, K & keyof T> & Partial<Pick<T, K & keyof T>>;
11
+ export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
12
12
  /** Make keys in object required */
13
- export type RequiredKey<T, K extends keyof T> = Omit<T, K & keyof T> & Required<Pick<T, K & keyof T>>;
13
+ export type RequiredKey<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
14
14
  /** Get contructor type of an instance */
15
15
  export type Constructor<T> = new (..._arguments: any[]) => T;
16
16
  /** Recursively resolves promises in objects and arrays */
@@ -59,3 +59,12 @@ export type Concat<T, U> = T extends any[] ? U extends any[] ? [...T, ...U] : ne
59
59
  export type Prettify<T extends object> = {
60
60
  [k in keyof T]: T[k];
61
61
  } & {};
62
+ /**
63
+ * Create a tuple of size.
64
+ *
65
+ * ```ts
66
+ * type a = Tuple<number, 3>
67
+ * type b = [number, number, number]
68
+ * ```
69
+ */
70
+ export type Tuple<T, N extends number, R extends readonly T[] = []> = R['length'] extends N ? R : Tuple<T, N, [...R, T]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softsky/utils",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "JavaScript/TypeScript utilities",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "homepage": "https://github.com/SoundOfTheSky/utils#readme",
22
22
  "devDependencies": {
23
- "@softsky/configs": "^1.3.4",
24
- "@types/bun": "^1.2.23"
23
+ "@softsky/configs": "^1.3.5",
24
+ "@types/bun": "^1.3.2"
25
25
  },
26
26
  "files": ["dist/**/*"]
27
27
  }