expensify-common 2.0.149 → 2.0.150
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/ExpenseRule.d.ts +2 -2
- package/dist/ExpenseRule.js +12 -4
- package/package.json +1 -1
package/dist/ExpenseRule.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export default class ExpenseRule {
|
|
|
2
2
|
/**
|
|
3
3
|
* Creates a new instance of this class.
|
|
4
4
|
*
|
|
5
|
-
* @param {Array} ruleArray
|
|
5
|
+
* @param {Object|Array} ruleArray
|
|
6
6
|
*/
|
|
7
|
-
constructor(ruleArray: any[]);
|
|
7
|
+
constructor(ruleArray: Object | any[]);
|
|
8
8
|
/**
|
|
9
9
|
* Returns the applyWhen array associated with the passed field
|
|
10
10
|
* i.e. field == category returns [field: 'category', condition: 'matches', value: 'car']
|
package/dist/ExpenseRule.js
CHANGED
|
@@ -4,12 +4,20 @@ class ExpenseRule {
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new instance of this class.
|
|
6
6
|
*
|
|
7
|
-
* @param {Array} ruleArray
|
|
7
|
+
* @param {Object|Array} ruleArray
|
|
8
8
|
*/
|
|
9
9
|
constructor(ruleArray) {
|
|
10
|
-
ruleArray
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// It's not 100% certain that `ruleArray` is an array or an object, so support both of them so the app doesn't crash
|
|
11
|
+
if (Array.isArray(ruleArray)) {
|
|
12
|
+
ruleArray.forEach((value, key) => {
|
|
13
|
+
this[key] = value;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
else if (ruleArray && typeof ruleArray === 'object') {
|
|
17
|
+
Object.keys(ruleArray).forEach((key) => {
|
|
18
|
+
this[key] = ruleArray[key];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
13
21
|
}
|
|
14
22
|
/**
|
|
15
23
|
* Returns the applyWhen array associated with the passed field
|