pinia-orm-edge 1.9.2-28644224.417ef5c → 1.9.2-28660070.3210918

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/dist/helpers.cjs CHANGED
@@ -66,4 +66,5 @@ exports.useKeys = useKeys;
66
66
  exports.useMax = useMax;
67
67
  exports.useMin = useMin;
68
68
  exports.usePluck = usePluck;
69
+ exports.useSortBy = useSortBy;
69
70
  exports.useSum = useSum;
@@ -6,6 +6,11 @@ import '@/composables';
6
6
  type SortFlags = 'SORT_REGULAR' | 'SORT_FLAG_CASE';
7
7
 
8
8
  type sorting<T> = ((record: T) => any) | string | [string, 'asc' | 'desc'][];
9
+ /**
10
+ * Creates an array of elements, sorted in specified order by the results
11
+ * of running each element in a collection thru each iteratee.
12
+ */
13
+ declare function useSortBy<T extends Record<string, any>>(collection: T[], sort: sorting<T>, flags?: SortFlags): T[];
9
14
 
10
15
  interface UseCollect<M extends Model = Model> {
11
16
  sum: (field: string) => number;
@@ -51,4 +56,4 @@ declare function useMax(models: Collection, field: string): number;
51
56
  */
52
57
  declare function usePluck(models: Collection, field: string): any[];
53
58
 
54
- export { type UseCollect, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
59
+ export { type UseCollect, type sorting, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };
@@ -6,6 +6,11 @@ import '@/composables';
6
6
  type SortFlags = 'SORT_REGULAR' | 'SORT_FLAG_CASE';
7
7
 
8
8
  type sorting<T> = ((record: T) => any) | string | [string, 'asc' | 'desc'][];
9
+ /**
10
+ * Creates an array of elements, sorted in specified order by the results
11
+ * of running each element in a collection thru each iteratee.
12
+ */
13
+ declare function useSortBy<T extends Record<string, any>>(collection: T[], sort: sorting<T>, flags?: SortFlags): T[];
9
14
 
10
15
  interface UseCollect<M extends Model = Model> {
11
16
  sum: (field: string) => number;
@@ -51,4 +56,4 @@ declare function useMax(models: Collection, field: string): number;
51
56
  */
52
57
  declare function usePluck(models: Collection, field: string): any[];
53
58
 
54
- export { type UseCollect, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
59
+ export { type UseCollect, type sorting, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };
package/dist/helpers.d.ts CHANGED
@@ -6,6 +6,11 @@ import '@/composables';
6
6
  type SortFlags = 'SORT_REGULAR' | 'SORT_FLAG_CASE';
7
7
 
8
8
  type sorting<T> = ((record: T) => any) | string | [string, 'asc' | 'desc'][];
9
+ /**
10
+ * Creates an array of elements, sorted in specified order by the results
11
+ * of running each element in a collection thru each iteratee.
12
+ */
13
+ declare function useSortBy<T extends Record<string, any>>(collection: T[], sort: sorting<T>, flags?: SortFlags): T[];
9
14
 
10
15
  interface UseCollect<M extends Model = Model> {
11
16
  sum: (field: string) => number;
@@ -51,4 +56,4 @@ declare function useMax(models: Collection, field: string): number;
51
56
  */
52
57
  declare function usePluck(models: Collection, field: string): any[];
53
58
 
54
- export { type UseCollect, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
59
+ export { type UseCollect, type sorting, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };
package/dist/helpers.mjs CHANGED
@@ -58,4 +58,4 @@ function useCollect(models) {
58
58
  };
59
59
  }
60
60
 
61
- export { useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
61
+ export { useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinia-orm-edge",
3
- "version": "1.9.2-28644224.417ef5c",
3
+ "version": "1.9.2-28660070.3210918",
4
4
  "description": "The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.",
5
5
  "keywords": [
6
6
  "vue",
@@ -46,7 +46,7 @@
46
46
  "pinia": "^2.1.7"
47
47
  },
48
48
  "dependencies": {
49
- "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.9.2-28644224.417ef5c"
49
+ "@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.9.2-28660070.3210918"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@nuxt/eslint-config": "^0.3.13",