@provis/provis-common-be-module 2.6.13 → 2.6.15
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.
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Search an object map and return the first item that matches the given value.
|
|
3
|
+
*
|
|
4
|
+
* @param map - Object map that contains the data to be searched.
|
|
5
|
+
* @param params - Object property name used as the search key.
|
|
6
|
+
* @param code - Value to match against the specified property.
|
|
7
|
+
*
|
|
8
|
+
* @returns The matched object if found, otherwise undefined.
|
|
9
|
+
* @example: findObjectByParams(src/constants/product/cargo/status, 'code', '200') ->. return {
|
|
10
|
+
code: '100',
|
|
11
|
+
desc: {
|
|
12
|
+
id: 'Sudah dibayar',
|
|
13
|
+
en: 'Paid',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
*/
|
|
17
|
+
declare const _default: (map: any, params: string, code: string) => any;
|
|
2
18
|
export default _default;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Search an object map and return the first item that matches the given value.
|
|
5
|
+
*
|
|
6
|
+
* @param map - Object map that contains the data to be searched.
|
|
7
|
+
* @param params - Object property name used as the search key.
|
|
8
|
+
* @param code - Value to match against the specified property.
|
|
9
|
+
*
|
|
10
|
+
* @returns The matched object if found, otherwise undefined.
|
|
11
|
+
* @example: findObjectByParams(src/constants/product/cargo/status, 'code', '200') ->. return {
|
|
12
|
+
code: '100',
|
|
13
|
+
desc: {
|
|
14
|
+
id: 'Sudah dibayar',
|
|
15
|
+
en: 'Paid',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
*/
|
|
3
19
|
exports.default = (map, params, code) => {
|
|
4
20
|
return Object.values(map).find((status) => status[params] === code);
|
|
5
21
|
};
|