@softsky/utils 1.1.0 → 1.1.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 +2 -0
- package/dist/arrays.js +0 -2
- package/dist/control.js +0 -1
- package/dist/types.d.ts +5 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -125,6 +125,8 @@ Find next cron tick after passed date
|
|
|
125
125
|
Damn, I **love** TypeScript.
|
|
126
126
|
### type Optional
|
|
127
127
|
Make keys in object optional
|
|
128
|
+
### type Required
|
|
129
|
+
Make keys in object required
|
|
128
130
|
### type Constructor
|
|
129
131
|
Get contructor type of an instance
|
|
130
132
|
### type AwaitedObject
|
package/dist/arrays.js
CHANGED
|
@@ -61,7 +61,6 @@ export function chunk(array, chunkSize) {
|
|
|
61
61
|
/** Return all combinations of items in array */
|
|
62
62
|
export function combinations(array) {
|
|
63
63
|
const amount = 1 << array.length;
|
|
64
|
-
// eslint-disable-next-line unicorn/no-new-array
|
|
65
64
|
const combinations = new Array(amount);
|
|
66
65
|
for (let combinationIndex = 0; combinationIndex < amount; combinationIndex++) {
|
|
67
66
|
const combination = [];
|
|
@@ -76,7 +75,6 @@ export function combinations(array) {
|
|
|
76
75
|
export function permutations(array) {
|
|
77
76
|
const n = array.length;
|
|
78
77
|
const result = [];
|
|
79
|
-
// eslint-disable-next-line unicorn/no-new-array
|
|
80
78
|
const control = new Array(n).fill(0);
|
|
81
79
|
result.push([...array]);
|
|
82
80
|
let index = 0;
|
package/dist/control.js
CHANGED
|
@@ -112,7 +112,6 @@ export function createDelayedFunction(function_, time) {
|
|
|
112
112
|
export class ImmediatePromise extends Promise {
|
|
113
113
|
resolve;
|
|
114
114
|
reject;
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
115
|
constructor(execute) {
|
|
117
116
|
if (execute)
|
|
118
117
|
super(execute);
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* Damn, I **love** TypeScript.
|
|
3
3
|
*/
|
|
4
4
|
/** Make keys in object optional */
|
|
5
|
-
export type Optional<T, K extends keyof
|
|
5
|
+
export type Optional<T, K extends keyof T> = Omit<T, K & keyof T> & Partial<Pick<T, K & keyof T>>;
|
|
6
|
+
/** Make keys in object required */
|
|
7
|
+
export type Required<T, K extends keyof T> = Omit<T, K & keyof T> & {
|
|
8
|
+
[P in K]-?: T[P];
|
|
9
|
+
};
|
|
6
10
|
/** Get contructor type of an instance */
|
|
7
11
|
export type Constructor<T> = abstract new (..._arguments: never[]) => T;
|
|
8
12
|
/** Recursively resolves promises in objects and arrays */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softsky/utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "JavaScript/TypeScript utilities",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/SoundOfTheSky/utils#readme",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@softsky/configs": "^1.0
|
|
23
|
-
"@types/bun": "^1.
|
|
22
|
+
"@softsky/configs": "^1.1.0",
|
|
23
|
+
"@types/bun": "^1.2.0"
|
|
24
24
|
},
|
|
25
25
|
"files": ["dist/**/*"]
|
|
26
26
|
}
|