@valkyriestudios/utils 12.14.0 → 12.15.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/array/sort.d.ts +4 -4
- package/index.d.ts +4 -4
- package/package.json +1 -1
package/array/sort.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
type sortOptions<T> = {
|
|
2
2
|
/**
|
|
3
3
|
* Filter function to apply to the array before sorting
|
|
4
4
|
* (default=isNotEmptyObject)
|
|
5
5
|
*/
|
|
6
|
-
filter_fn?: (el:
|
|
6
|
+
filter_fn?: (el: T) => boolean;
|
|
7
7
|
/**
|
|
8
8
|
* Remove objects that don't have the key or where the key is falsy
|
|
9
9
|
* (default=false)
|
|
@@ -14,7 +14,7 @@ interface sortOptions {
|
|
|
14
14
|
* (default=true)
|
|
15
15
|
*/
|
|
16
16
|
nokey_atend?: boolean;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
type sortByFunction = (el: Record<string, any>) => string;
|
|
19
19
|
/**
|
|
20
20
|
* Sort an array of objects.
|
|
@@ -60,5 +60,5 @@ type sortByFunction = (el: Record<string, any>) => string;
|
|
|
60
60
|
*/
|
|
61
61
|
declare function sort<T extends {
|
|
62
62
|
[key: string]: any;
|
|
63
|
-
}[]>(arr: T, by: string | sortByFunction, dir?: 'asc' | 'desc', opts?: sortOptions): T;
|
|
63
|
+
}[]>(arr: T, by: string | sortByFunction, dir?: 'asc' | 'desc', opts?: sortOptions<T>): T;
|
|
64
64
|
export { sort, sort as default };
|
package/index.d.ts
CHANGED
|
@@ -82,15 +82,15 @@ declare module "array/shuffle" {
|
|
|
82
82
|
export { shuffle, shuffle as default };
|
|
83
83
|
}
|
|
84
84
|
declare module "array/sort" {
|
|
85
|
-
|
|
86
|
-
filter_fn?: (el:
|
|
85
|
+
type sortOptions<T> = {
|
|
86
|
+
filter_fn?: (el: T) => boolean;
|
|
87
87
|
nokey_hide?: boolean;
|
|
88
88
|
nokey_atend?: boolean;
|
|
89
|
-
}
|
|
89
|
+
};
|
|
90
90
|
type sortByFunction = (el: Record<string, any>) => string;
|
|
91
91
|
function sort<T extends {
|
|
92
92
|
[key: string]: any;
|
|
93
|
-
}[]>(arr: T, by: string | sortByFunction, dir?: 'asc' | 'desc', opts?: sortOptions): T;
|
|
93
|
+
}[]>(arr: T, by: string | sortByFunction, dir?: 'asc' | 'desc', opts?: sortOptions<T>): T;
|
|
94
94
|
export { sort, sort as default };
|
|
95
95
|
}
|
|
96
96
|
declare module "array/index" {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@valkyriestudios/utils", "version": "12.
|
|
1
|
+
{ "name": "@valkyriestudios/utils", "version": "12.15.0", "description": "A collection of single-function utilities for common tasks", "author": { "name": "Peter Vermeulen", "url": "https://www.linkedin.com/in/petervermeulen1/" }, "keywords": [ "utility", "library", "javascript", "js", "node", "bun" ], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/ValkyrieStudios/utils.git" }, "bugs": { "url": "https://github.com/ValkyrieStudios/utils/issues" }, "homepage": "https://github.com/ValkyrieStudios/utils#readme", "types": "index.d.ts" }
|