law-common 1.2.14 → 1.2.16
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.
|
@@ -18,7 +18,7 @@ export interface IClientEntity extends IAuditColumnEntity {
|
|
|
18
18
|
export interface IClientEntityDependent {
|
|
19
19
|
partnerIds: number[];
|
|
20
20
|
}
|
|
21
|
-
export type IClientExclude =
|
|
21
|
+
export type IClientExclude = "organizationId";
|
|
22
22
|
export interface IClientEntityCreateDto extends Omit<IEntityCreateDto<IClientEntity>, IClientExclude>, IClientEntityDependent {
|
|
23
23
|
}
|
|
24
24
|
export interface IClientEntityUpdateDto extends Omit<IEntityUpdateDto<IClientEntity>, IClientExclude>, Partial<IClientEntityDependent> {
|
|
@@ -4,4 +4,79 @@ export declare function convertMapToObject<K, T>(map: Map<K, T>): {
|
|
|
4
4
|
[key: string]: T;
|
|
5
5
|
};
|
|
6
6
|
export declare function removeSamePropertyValues(source: any, target: any): void;
|
|
7
|
+
/**
|
|
8
|
+
* Removes elements from the target array that are present in the source array.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The type of elements in the arrays.
|
|
11
|
+
* @param {T[]} source - The array containing elements to be excluded from the target array.
|
|
12
|
+
* @param {T[]} target - The array from which elements will be filtered out.
|
|
13
|
+
* @returns {T[]} A new array containing elements from the target array that are not present in the source array.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const source = [1, 2, 3];
|
|
17
|
+
* const target = [1, 2, 3, 4, 5, 6];
|
|
18
|
+
* const result = removeElementsFromArray(source, target);
|
|
19
|
+
* console.log(result); // Output: [4, 5, 6]
|
|
20
|
+
*/
|
|
7
21
|
export declare function removeElementsFromArray<T>(source: T[], target: T[]): T[];
|
|
22
|
+
/**
|
|
23
|
+
* Returns a new array with elements from the target array that are not present in the source array.
|
|
24
|
+
*
|
|
25
|
+
* @template T - The type of elements in the arrays.
|
|
26
|
+
* @param {T[]} source - The array containing elements to be excluded from the target array.
|
|
27
|
+
* @param {T[]} target - The array from which elements will be filtered out.
|
|
28
|
+
* @returns {T[]} A new array containing elements from the target array that are not present in the source array.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const source = [1, 2, 3];
|
|
32
|
+
* const target = [1, 2, 3, 4, 5, 6];
|
|
33
|
+
* const result = arrayDifference(source, target);
|
|
34
|
+
* console.log(result); // Output: [4, 5, 6]
|
|
35
|
+
*/
|
|
36
|
+
export declare function arrayDifference<T>(source: T[], target: T[]): T[];
|
|
37
|
+
/**
|
|
38
|
+
* Returns a new array containing elements that are present in both the source and target arrays.
|
|
39
|
+
*
|
|
40
|
+
* @template T - The type of elements in the arrays.
|
|
41
|
+
* @param {T[]} source - The first array to compare.
|
|
42
|
+
* @param {T[]} target - The second array to compare.
|
|
43
|
+
* @returns {T[]} A new array containing elements that are present in both the source and target arrays.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const source = [1, 2, 3];
|
|
47
|
+
* const target = [2, 3, 4];
|
|
48
|
+
* const result = arrayIntersection(source, target);
|
|
49
|
+
* console.log(result); // Output: [2, 3]
|
|
50
|
+
*/
|
|
51
|
+
export declare function arrayIntersection<T>(source: T[], target: T[]): T[];
|
|
52
|
+
/**
|
|
53
|
+
* Returns a new array containing elements that are present in both the source and target arrays.
|
|
54
|
+
*
|
|
55
|
+
* @template T - The type of elements in the arrays.
|
|
56
|
+
* @param {T[]} source - The first array to compare.
|
|
57
|
+
* @param {T[]} target - The second array to compare.
|
|
58
|
+
* @param {(a: T, b: T) => boolean} comparator - The function to determine if two elements are equal.
|
|
59
|
+
* @returns {T[]} A new array containing elements that are present in both the source and target arrays.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* const source = [{ id: 1, name: "John" }, { id: 2, name: "Jane" }];
|
|
63
|
+
* const target = [{ id: 2, name: "Jane" }, { id: 3, name: "Doe" }];
|
|
64
|
+
* const result = arrayIntersectionWith(source, target, (a, b) => a.id === b.id);
|
|
65
|
+
* console.log(result); // Output: [{ id: 2, name: "Jane" }]
|
|
66
|
+
*/
|
|
67
|
+
export declare function arrayIntersectionWith<T>(source: T[], target: T[], comparator: (a: T, b: T) => boolean): T[];
|
|
68
|
+
/**
|
|
69
|
+
* Returns a new array containing elements that are present in either the source or target arrays.
|
|
70
|
+
*
|
|
71
|
+
* @template T - The type of elements in the arrays.
|
|
72
|
+
* @param {T[]} source - The first array to compare.
|
|
73
|
+
* @param {T[]} target - The second array to compare.
|
|
74
|
+
* @returns {T[]} A new array containing elements that are present in either the source or target arrays.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* const source = [1, 2, 3];
|
|
78
|
+
* const target = [2, 3, 4];
|
|
79
|
+
* const result = arrayUnion(source, target);
|
|
80
|
+
* console.log(result); // Output: [1, 2, 3, 4]
|
|
81
|
+
*/
|
|
82
|
+
export declare function arrayUnion<T>(source: T[], target: T[]): T[];
|
|
@@ -5,6 +5,10 @@ exports.groupByOneToOneFunction = groupByOneToOneFunction;
|
|
|
5
5
|
exports.convertMapToObject = convertMapToObject;
|
|
6
6
|
exports.removeSamePropertyValues = removeSamePropertyValues;
|
|
7
7
|
exports.removeElementsFromArray = removeElementsFromArray;
|
|
8
|
+
exports.arrayDifference = arrayDifference;
|
|
9
|
+
exports.arrayIntersection = arrayIntersection;
|
|
10
|
+
exports.arrayIntersectionWith = arrayIntersectionWith;
|
|
11
|
+
exports.arrayUnion = arrayUnion;
|
|
8
12
|
function groupByFunction(list, keyGetter) {
|
|
9
13
|
const map = new Map();
|
|
10
14
|
list.forEach((item) => {
|
|
@@ -37,6 +41,90 @@ function removeSamePropertyValues(source, target) {
|
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Removes elements from the target array that are present in the source array.
|
|
46
|
+
*
|
|
47
|
+
* @template T - The type of elements in the arrays.
|
|
48
|
+
* @param {T[]} source - The array containing elements to be excluded from the target array.
|
|
49
|
+
* @param {T[]} target - The array from which elements will be filtered out.
|
|
50
|
+
* @returns {T[]} A new array containing elements from the target array that are not present in the source array.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* const source = [1, 2, 3];
|
|
54
|
+
* const target = [1, 2, 3, 4, 5, 6];
|
|
55
|
+
* const result = removeElementsFromArray(source, target);
|
|
56
|
+
* console.log(result); // Output: [4, 5, 6]
|
|
57
|
+
*/
|
|
40
58
|
function removeElementsFromArray(source, target) {
|
|
41
59
|
return target.filter((element) => !source.includes(element));
|
|
42
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns a new array with elements from the target array that are not present in the source array.
|
|
63
|
+
*
|
|
64
|
+
* @template T - The type of elements in the arrays.
|
|
65
|
+
* @param {T[]} source - The array containing elements to be excluded from the target array.
|
|
66
|
+
* @param {T[]} target - The array from which elements will be filtered out.
|
|
67
|
+
* @returns {T[]} A new array containing elements from the target array that are not present in the source array.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* const source = [1, 2, 3];
|
|
71
|
+
* const target = [1, 2, 3, 4, 5, 6];
|
|
72
|
+
* const result = arrayDifference(source, target);
|
|
73
|
+
* console.log(result); // Output: [4, 5, 6]
|
|
74
|
+
*/
|
|
75
|
+
function arrayDifference(source, target) {
|
|
76
|
+
return target.filter((element) => !source.includes(element));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns a new array containing elements that are present in both the source and target arrays.
|
|
80
|
+
*
|
|
81
|
+
* @template T - The type of elements in the arrays.
|
|
82
|
+
* @param {T[]} source - The first array to compare.
|
|
83
|
+
* @param {T[]} target - The second array to compare.
|
|
84
|
+
* @returns {T[]} A new array containing elements that are present in both the source and target arrays.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* const source = [1, 2, 3];
|
|
88
|
+
* const target = [2, 3, 4];
|
|
89
|
+
* const result = arrayIntersection(source, target);
|
|
90
|
+
* console.log(result); // Output: [2, 3]
|
|
91
|
+
*/
|
|
92
|
+
function arrayIntersection(source, target) {
|
|
93
|
+
return target.filter((element) => source.includes(element));
|
|
94
|
+
}
|
|
95
|
+
// js docs
|
|
96
|
+
/**
|
|
97
|
+
* Returns a new array containing elements that are present in both the source and target arrays.
|
|
98
|
+
*
|
|
99
|
+
* @template T - The type of elements in the arrays.
|
|
100
|
+
* @param {T[]} source - The first array to compare.
|
|
101
|
+
* @param {T[]} target - The second array to compare.
|
|
102
|
+
* @param {(a: T, b: T) => boolean} comparator - The function to determine if two elements are equal.
|
|
103
|
+
* @returns {T[]} A new array containing elements that are present in both the source and target arrays.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* const source = [{ id: 1, name: "John" }, { id: 2, name: "Jane" }];
|
|
107
|
+
* const target = [{ id: 2, name: "Jane" }, { id: 3, name: "Doe" }];
|
|
108
|
+
* const result = arrayIntersectionWith(source, target, (a, b) => a.id === b.id);
|
|
109
|
+
* console.log(result); // Output: [{ id: 2, name: "Jane" }]
|
|
110
|
+
*/
|
|
111
|
+
function arrayIntersectionWith(source, target, comparator) {
|
|
112
|
+
return target.filter((element) => source.some((item) => comparator(item, element)));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns a new array containing elements that are present in either the source or target arrays.
|
|
116
|
+
*
|
|
117
|
+
* @template T - The type of elements in the arrays.
|
|
118
|
+
* @param {T[]} source - The first array to compare.
|
|
119
|
+
* @param {T[]} target - The second array to compare.
|
|
120
|
+
* @returns {T[]} A new array containing elements that are present in either the source or target arrays.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const source = [1, 2, 3];
|
|
124
|
+
* const target = [2, 3, 4];
|
|
125
|
+
* const result = arrayUnion(source, target);
|
|
126
|
+
* console.log(result); // Output: [1, 2, 3, 4]
|
|
127
|
+
*/
|
|
128
|
+
function arrayUnion(source, target) {
|
|
129
|
+
return [...new Set([...source, ...target])];
|
|
130
|
+
}
|