@thisisagile/easy 10.10.1 → 10.10.2

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.
@@ -11,6 +11,6 @@ export declare type PageOptions = {
11
11
  export declare type PageList<T> = List<T> & Omit<PageOptions, 'sort'> & {
12
12
  total?: number;
13
13
  };
14
- export declare const toPageList: <T>(items?: T[] | undefined, options?: (PageOptions & {
14
+ export declare const toPageList: <T>(items?: T[] | undefined, options?: (Omit<PageOptions, "sort"> & {
15
15
  total?: number | undefined;
16
16
  }) | undefined) => PageList<T>;
@@ -2,13 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toPageList = void 0;
4
4
  const List_1 = require("./List");
5
- const Json_1 = require("./Json");
6
5
  const toPageList = (items, options) => {
7
- const o = Json_1.json.defaults(options, { take: 250, skip: 0 });
8
6
  const list = (0, List_1.toList)(...(items ?? []));
9
- list.take = o.take;
10
- list.skip = o.skip;
11
- list.total = o.total;
7
+ list.take = options?.take ?? 250;
8
+ list.skip = options?.skip ?? 0;
9
+ list.total = options?.total;
12
10
  return list;
13
11
  };
14
12
  exports.toPageList = toPageList;
@@ -1 +1 @@
1
- {"version":3,"file":"PageList.js","sourceRoot":"","sources":["../../src/types/PageList.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AACtC,iCAA8B;AAQvB,MAAM,UAAU,GAAG,CAAK,KAAW,EAAE,OAA0C,EAAe,EAAE;IACrG,MAAM,CAAC,GAAG,WAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAA,aAAM,EAAI,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAQ,CAAC;IAChD,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;IACnB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;IACnB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IACrB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAPW,QAAA,UAAU,cAOrB"}
1
+ {"version":3,"file":"PageList.js","sourceRoot":"","sources":["../../src/types/PageList.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAQ/B,MAAM,UAAU,GAAG,CAAI,KAAW,EAAE,OAAwD,EAAe,EAAE;IAClH,MAAM,IAAI,GAAG,IAAA,aAAM,EAAI,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAQ,CAAC;IAChD,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,GAAG,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "10.10.1",
3
+ "version": "10.10.2",
4
4
  "description": "Straightforward library for building domain-driven microservice architectures",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "devDependencies": {
34
- "@thisisagile/easy-test": "10.10.1",
34
+ "@thisisagile/easy-test": "10.10.2",
35
35
  "@types/form-urlencoded": "^4.4.0",
36
36
  "@types/jsonwebtoken": "^8.5.8",
37
37
  "@types/validator": "^13.7.2"
@@ -1,17 +1,15 @@
1
1
  import { List, toList } from './List';
2
- import { json } from './Json';
3
2
 
4
- export type Sort = { key: string, value: -1 | 1 };
3
+ export type Sort = { key: string; value: -1 | 1 };
5
4
 
6
- export type PageOptions = { take?: number, skip?: number, sort?: Sort[] };
5
+ export type PageOptions = { take?: number; skip?: number; sort?: Sort[] };
7
6
 
8
7
  export type PageList<T> = List<T> & Omit<PageOptions, 'sort'> & { total?: number };
9
8
 
10
- export const toPageList = <T>( items?: T[], options?: PageOptions & { total?: number }): PageList<T> => {
11
- const o = json.defaults(options, { take: 250, skip: 0 });
9
+ export const toPageList = <T>(items?: T[], options?: Omit<PageOptions, 'sort'> & { total?: number }): PageList<T> => {
12
10
  const list = toList<T>(...(items ?? [])) as any;
13
- list.take = o.take;
14
- list.skip = o.skip;
15
- list.total = o.total;
11
+ list.take = options?.take ?? 250;
12
+ list.skip = options?.skip ?? 0;
13
+ list.total = options?.total;
16
14
  return list;
17
15
  };