@qrvey/utils 1.15.0-6 → 1.15.0-8
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/cjs/general/array/howManyByParam.d.ts +8 -0
- package/dist/cjs/general/array/howManyByParam.js +21 -0
- package/dist/cjs/general/array/index.d.ts +2 -0
- package/dist/cjs/general/array/index.js +2 -0
- package/dist/cjs/globalization/interfaces/export/II18nExportingModal.d.ts +1 -0
- package/dist/cjs/globalization/labels/export/I18N_EXPORT_MODAL.js +1 -0
- package/dist/general/array/howManyByParam.d.ts +8 -0
- package/dist/general/array/howManyByParam.js +17 -0
- package/dist/general/array/index.d.ts +2 -0
- package/dist/general/array/index.js +2 -0
- package/dist/globalization/interfaces/export/II18nExportingModal.d.ts +1 -0
- package/dist/globalization/labels/export/I18N_EXPORT_MODAL.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the number of times that the param value exists into the object array
|
|
3
|
+
* @param array the given array
|
|
4
|
+
* @param param the param of the array object to compare
|
|
5
|
+
* @param value the value of the array object to compare
|
|
6
|
+
* @returns the number of times the parameter value exists
|
|
7
|
+
*/
|
|
8
|
+
export declare function howManyByParam<T = Record<string, unknown>>(array: T[], param: keyof T, value: unknown): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.howManyByParam = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Gets the number of times that the param value exists into the object array
|
|
6
|
+
* @param array the given array
|
|
7
|
+
* @param param the param of the array object to compare
|
|
8
|
+
* @param value the value of the array object to compare
|
|
9
|
+
* @returns the number of times the parameter value exists
|
|
10
|
+
*/
|
|
11
|
+
function howManyByParam(array, param, value) {
|
|
12
|
+
let count = 0;
|
|
13
|
+
if (!Array.isArray(array))
|
|
14
|
+
return count;
|
|
15
|
+
for (const i of array) {
|
|
16
|
+
if (i[param] === value)
|
|
17
|
+
count = count + 1;
|
|
18
|
+
}
|
|
19
|
+
return count;
|
|
20
|
+
}
|
|
21
|
+
exports.howManyByParam = howManyByParam;
|
|
@@ -4,5 +4,7 @@ export * from "./flattenDeep";
|
|
|
4
4
|
export * from "./getArrayByProperty";
|
|
5
5
|
export * from "./filterNestedTree";
|
|
6
6
|
export * from "./getFirstIndexFromArray";
|
|
7
|
+
export * from "./getUniqueArray";
|
|
8
|
+
export * from "./howManyByParam";
|
|
7
9
|
export * from "./getLastIndexFromArray";
|
|
8
10
|
export * from "./intersectObjectArrays";
|
|
@@ -20,5 +20,7 @@ __exportStar(require("./flattenDeep"), exports);
|
|
|
20
20
|
__exportStar(require("./getArrayByProperty"), exports);
|
|
21
21
|
__exportStar(require("./filterNestedTree"), exports);
|
|
22
22
|
__exportStar(require("./getFirstIndexFromArray"), exports);
|
|
23
|
+
__exportStar(require("./getUniqueArray"), exports);
|
|
24
|
+
__exportStar(require("./howManyByParam"), exports);
|
|
23
25
|
__exportStar(require("./getLastIndexFromArray"), exports);
|
|
24
26
|
__exportStar(require("./intersectObjectArrays"), exports);
|
|
@@ -45,6 +45,7 @@ exports.EXPORTING_MODAL = {
|
|
|
45
45
|
pivot_columns_sublabel: "Displaying only the first 100 results.",
|
|
46
46
|
},
|
|
47
47
|
columns_to_export_label: "Columns to export",
|
|
48
|
+
no_results_found: "No results found",
|
|
48
49
|
},
|
|
49
50
|
schedule: {
|
|
50
51
|
chart_download_ready: "Chart is ready to download",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the number of times that the param value exists into the object array
|
|
3
|
+
* @param array the given array
|
|
4
|
+
* @param param the param of the array object to compare
|
|
5
|
+
* @param value the value of the array object to compare
|
|
6
|
+
* @returns the number of times the parameter value exists
|
|
7
|
+
*/
|
|
8
|
+
export declare function howManyByParam<T = Record<string, unknown>>(array: T[], param: keyof T, value: unknown): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the number of times that the param value exists into the object array
|
|
3
|
+
* @param array the given array
|
|
4
|
+
* @param param the param of the array object to compare
|
|
5
|
+
* @param value the value of the array object to compare
|
|
6
|
+
* @returns the number of times the parameter value exists
|
|
7
|
+
*/
|
|
8
|
+
export function howManyByParam(array, param, value) {
|
|
9
|
+
let count = 0;
|
|
10
|
+
if (!Array.isArray(array))
|
|
11
|
+
return count;
|
|
12
|
+
for (const i of array) {
|
|
13
|
+
if (i[param] === value)
|
|
14
|
+
count = count + 1;
|
|
15
|
+
}
|
|
16
|
+
return count;
|
|
17
|
+
}
|
|
@@ -4,5 +4,7 @@ export * from "./flattenDeep";
|
|
|
4
4
|
export * from "./getArrayByProperty";
|
|
5
5
|
export * from "./filterNestedTree";
|
|
6
6
|
export * from "./getFirstIndexFromArray";
|
|
7
|
+
export * from "./getUniqueArray";
|
|
8
|
+
export * from "./howManyByParam";
|
|
7
9
|
export * from "./getLastIndexFromArray";
|
|
8
10
|
export * from "./intersectObjectArrays";
|
|
@@ -4,5 +4,7 @@ export * from "./flattenDeep";
|
|
|
4
4
|
export * from "./getArrayByProperty";
|
|
5
5
|
export * from "./filterNestedTree";
|
|
6
6
|
export * from "./getFirstIndexFromArray";
|
|
7
|
+
export * from "./getUniqueArray";
|
|
8
|
+
export * from "./howManyByParam";
|
|
7
9
|
export * from "./getLastIndexFromArray";
|
|
8
10
|
export * from "./intersectObjectArrays";
|
|
@@ -42,6 +42,7 @@ export const EXPORTING_MODAL = {
|
|
|
42
42
|
pivot_columns_sublabel: "Displaying only the first 100 results.",
|
|
43
43
|
},
|
|
44
44
|
columns_to_export_label: "Columns to export",
|
|
45
|
+
no_results_found: "No results found",
|
|
45
46
|
},
|
|
46
47
|
schedule: {
|
|
47
48
|
chart_download_ready: "Chart is ready to download",
|