@smartsoft001/utils 2.49.0 → 2.50.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/package.json
CHANGED
|
@@ -34,7 +34,7 @@ export class ArrayService {
|
|
|
34
34
|
* @param by {function} - function to get sort key
|
|
35
35
|
* @returns {array} - sorted array
|
|
36
36
|
*/
|
|
37
|
-
static sort<T>(array: Array<T>, by: (item: T) =>
|
|
37
|
+
static sort<T>(array: Array<T>, by: (item: T) => unknown): Array<T> {
|
|
38
38
|
return _.sortBy(array, by);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { isNull } from 'util';
|
|
2
|
-
|
|
3
1
|
import { ObjectService } from './object.service';
|
|
4
2
|
|
|
5
3
|
describe('shared-utils: ObjectService', () => {
|
|
@@ -91,7 +89,7 @@ describe('shared-utils: ObjectService', () => {
|
|
|
91
89
|
obj.test1 = undefined;
|
|
92
90
|
obj.date = new Date();
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
ObjectService.removeTypes(obj);
|
|
95
93
|
|
|
96
94
|
expect(obj.test1 === undefined).toBeTruthy();
|
|
97
95
|
});
|
|
@@ -8,10 +8,10 @@ export class ObjectService {
|
|
|
8
8
|
* @return - new type object
|
|
9
9
|
*/
|
|
10
10
|
static createByType<T>(data: any, type: any): T {
|
|
11
|
-
if (!data) return data;
|
|
11
|
+
if (!data) return data as T;
|
|
12
12
|
|
|
13
13
|
try {
|
|
14
|
-
if (data instanceof type) return data;
|
|
14
|
+
if (data instanceof type) return data as T;
|
|
15
15
|
} catch (e) {
|
|
16
16
|
console.warn(e);
|
|
17
17
|
}
|