@trackunit/shared-utils 0.0.86 → 0.0.87

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/shared-utils",
3
- "version": "0.0.86",
3
+ "version": "0.0.87",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
package/src/Maybe.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Maybe type
3
+ */
4
+ export type Maybe<T> = T | null;
package/src/filter.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Maybe } from "./maybe";
1
+ import { Maybe } from "./Maybe";
2
2
  /**
3
3
  * Filter an array of items based on a list of properties and a search term.
4
4
  * The provided properties will be matched based on the term split on space.
@@ -11,7 +11,7 @@ import { Maybe } from "./maybe";
11
11
  * @returns {[]} The filtered array
12
12
  * @example filterByMultiple([{ name: "John", surname: "Doe" }, { name: "Jane", surname: "Doe" }], [p => p.name, p => p.surname], "John") // [{ name: "John", surname: "Doe" }]
13
13
  */
14
- export declare function filterByMultiple<T>(array: T[] | null | undefined, props: (p: T) => Maybe<string>[] | null | undefined, match: string): T[];
14
+ export declare function filterByMultiple<T>(array: T[] | null | undefined, props: (p: T) => (Maybe<string> | undefined)[] | null | undefined, match: string): T[];
15
15
  /**
16
16
  * Filter an array of items based on a list of properties and a search term.
17
17
  * The provided properties will be matched based on the term split on space.
package/src/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export * from "./filter";
12
12
  export * from "./groupBy/groupBy";
13
13
  export * from "./GroupingUtility";
14
14
  export * from "./idUtils";
15
- export * from "./maybe";
15
+ export * from "./Maybe";
16
16
  export * from "./objectUtils";
17
17
  export * from "./pathUtils";
18
18
  export * from "./pictureUtils/pictureUtils";
@@ -1,4 +1,4 @@
1
- import { Maybe } from "../maybe";
1
+ import { Maybe } from "../Maybe";
2
2
  /**
3
3
  * Compare two strings
4
4
  *
@@ -7,7 +7,7 @@ import { Maybe } from "../maybe";
7
7
  * @returns {number} 0 if equal, -1 if a < b, 1 if a > b
8
8
  * @example stringCompare("a", "b") // -1
9
9
  */
10
- export declare const stringCompare: (a: Maybe<string>, b: Maybe<string>) => number;
10
+ export declare const stringCompare: (a?: Maybe<string>, b?: Maybe<string>) => number;
11
11
  /**
12
12
  * Compare two strings
13
13
  *
@@ -16,7 +16,7 @@ export declare const stringCompare: (a: Maybe<string>, b: Maybe<string>) => numb
16
16
  * @returns {number} 0 if equal, -1 if a < b, 1 if a > b
17
17
  * @example stringCompare("a", "b") // -1
18
18
  */
19
- export declare const stringNaturalCompare: (a: Maybe<string>, b: Maybe<string>) => number;
19
+ export declare const stringNaturalCompare: (a?: Maybe<string>, b?: Maybe<string>) => number;
20
20
  /**
21
21
  * Compare two strings
22
22
  *
@@ -37,7 +37,7 @@ export declare const stringCompareFromKey: <T>(key: keyof T) => (a: T, b: T) =>
37
37
  * @example dateCompare(new Date("2021-05-19T12:34:56"), new Date("2021-05-19T12:34:56")) // 0
38
38
  * @example dateCompare(new Date("2021-05-19T12:34:57"), new Date("2021-05-19T12:34:56")) // 1
39
39
  */
40
- export declare const dateCompare: (a: Maybe<Date>, b: Maybe<Date>) => number;
40
+ export declare const dateCompare: (a?: Maybe<Date>, b?: Maybe<Date>) => number;
41
41
  /**
42
42
  * Compare two numbers
43
43
  *
@@ -48,7 +48,7 @@ export declare const dateCompare: (a: Maybe<Date>, b: Maybe<Date>) => number;
48
48
  * @example numberCompare(1, 1) // 0
49
49
  * @example numberCompare(2, 1) // 1
50
50
  */
51
- export declare const numberCompare: (a: Maybe<number>, b: Maybe<number>) => number;
51
+ export declare const numberCompare: (a?: Maybe<number>, b?: Maybe<number>) => number;
52
52
  /**
53
53
  * Compare two numbers
54
54
  *
@@ -59,7 +59,7 @@ export declare const numberCompare: (a: Maybe<number>, b: Maybe<number>) => numb
59
59
  * @example numberCompare(1, 1) // 0
60
60
  * @example numberCompare(2, 1) // 1
61
61
  */
62
- export declare const numberCompareUnknownAfterHighest: (a: Maybe<number>, b: Maybe<number>) => number;
62
+ export declare const numberCompareUnknownAfterHighest: (a?: Maybe<number>, b?: Maybe<number>) => number;
63
63
  /**
64
64
  * Compare two arrays
65
65
  *
@@ -70,7 +70,7 @@ export declare const numberCompareUnknownAfterHighest: (a: Maybe<number>, b: May
70
70
  * @example arrayCompare([1, 2], [1, 2], numberCompare) // 0
71
71
  * @example arrayCompare([1, 3], [1, 2], numberCompare) // 1
72
72
  */
73
- export declare const arrayLengthCompare: <T>(a: Maybe<T[]>, b: Maybe<T[]>) => number;
73
+ export declare const arrayLengthCompare: <T>(a?: Maybe<T[]>, b?: Maybe<T[]>) => number;
74
74
  /**
75
75
  * Compare two booleans
76
76
  *
@@ -81,4 +81,4 @@ export declare const arrayLengthCompare: <T>(a: Maybe<T[]>, b: Maybe<T[]>) => nu
81
81
  * @example booleanCompare(true, true) // 0
82
82
  * @example booleanCompare(false, true) // 1
83
83
  */
84
- export declare const booleanCompare: (a: Maybe<boolean>, b: Maybe<boolean>) => number;
84
+ export declare const booleanCompare: (a?: Maybe<boolean>, b?: Maybe<boolean>) => number;
package/src/maybe.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * Maybe type
3
- */
4
- export type Maybe<T> = T | null | undefined;