@stevenkellner/team-conduct-api 1.0.18 → 1.0.20

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.
@@ -7,6 +7,7 @@ export declare namespace FineAmount {
7
7
  amount: MoneyAmount;
8
8
  constructor(amount: MoneyAmount);
9
9
  formatted(configuration: Configuration): string;
10
+ multiplied(factor: number): Money;
10
11
  get flatten(): Money.Flatten;
11
12
  }
12
13
  namespace Money {
@@ -25,6 +26,7 @@ export declare namespace FineAmount {
25
26
  constructor(item: Item.Type, count: number);
26
27
  formatted(): string;
27
28
  formattedWithoutCount(): string;
29
+ multiplied(factor: number): Item;
28
30
  get flatten(): Item.Flatten;
29
31
  }
30
32
  namespace Item {
@@ -13,6 +13,9 @@ var FineAmount;
13
13
  formatted(configuration) {
14
14
  return this.amount.formatted(configuration.currency, configuration);
15
15
  }
16
+ multiplied(factor) {
17
+ return new Money(this.amount.multiplied(factor));
18
+ }
16
19
  get flatten() {
17
20
  return {
18
21
  type: 'money',
@@ -43,6 +46,9 @@ var FineAmount;
43
46
  formattedWithoutCount() {
44
47
  return Localization_1.Localization.shared.getN(key => key.fineAmount.item.type[`${this.item}WithoutCount`], this.count);
45
48
  }
49
+ multiplied(factor) {
50
+ return new Item(this.item, this.count * factor);
51
+ }
46
52
  get flatten() {
47
53
  return {
48
54
  type: 'item',
@@ -3,5 +3,10 @@ export type PayedState = 'payed' | 'notPayed';
3
3
  export declare namespace PayedState {
4
4
  const all: PayedState[];
5
5
  function formatted(state: PayedState): string;
6
+ function toggled(state: PayedState): PayedState;
7
+ function payedTag(state: PayedState): {
8
+ value: string;
9
+ severity: 'secondary' | 'danger';
10
+ };
6
11
  const builder: ValueTypeBuilder<PayedState>;
7
12
  }
@@ -10,5 +10,29 @@ var PayedState;
10
10
  return Localization_1.Localization.shared.get(key => key.payedState[state]);
11
11
  }
12
12
  PayedState.formatted = formatted;
13
+ function toggled(state) {
14
+ switch (state) {
15
+ case 'payed':
16
+ return 'notPayed';
17
+ case 'notPayed':
18
+ return 'payed';
19
+ }
20
+ }
21
+ PayedState.toggled = toggled;
22
+ function payedTag(state) {
23
+ switch (state) {
24
+ case 'payed':
25
+ return {
26
+ value: formatted(state),
27
+ severity: 'secondary'
28
+ };
29
+ case 'notPayed':
30
+ return {
31
+ value: formatted(state),
32
+ severity: 'danger'
33
+ };
34
+ }
35
+ }
36
+ PayedState.payedTag = payedTag;
13
37
  PayedState.builder = new typescript_common_functionality_1.ValueTypeBuilder();
14
38
  })(PayedState || (exports.PayedState = PayedState = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stevenkellner/team-conduct-api",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Firebase API for Team Conduct",
5
5
  "license": "MIT",
6
6
  "author": "Steven Kellner",
@@ -19,6 +19,10 @@ export namespace FineAmount {
19
19
  return this.amount.formatted(configuration.currency, configuration);
20
20
  }
21
21
 
22
+ public multiplied(factor: number): Money {
23
+ return new Money(this.amount.multiplied(factor));
24
+ }
25
+
22
26
  public get flatten(): Money.Flatten {
23
27
  return {
24
28
  type: 'money',
@@ -59,6 +63,10 @@ export namespace FineAmount {
59
63
  return Localization.shared.getN(key => key.fineAmount.item.type[`${this.item}WithoutCount`], this.count);
60
64
  }
61
65
 
66
+ public multiplied(factor: number): Item {
67
+ return new Item(this.item, this.count * factor);
68
+ }
69
+
62
70
  public get flatten(): Item.Flatten {
63
71
  return {
64
72
  type: 'item',
@@ -13,5 +13,29 @@ export namespace PayedState {
13
13
  return Localization.shared.get(key => key.payedState[state]);
14
14
  }
15
15
 
16
+ export function toggled(state: PayedState): PayedState {
17
+ switch (state) {
18
+ case 'payed':
19
+ return 'notPayed';
20
+ case 'notPayed':
21
+ return 'payed';
22
+ }
23
+ }
24
+
25
+ export function payedTag(state: PayedState): { value: string; severity: 'secondary' | 'danger' } {
26
+ switch (state) {
27
+ case 'payed':
28
+ return {
29
+ value: formatted(state),
30
+ severity: 'secondary'
31
+ };
32
+ case 'notPayed':
33
+ return {
34
+ value: formatted(state),
35
+ severity: 'danger'
36
+ };
37
+ }
38
+ }
39
+
16
40
  export const builder = new ValueTypeBuilder<PayedState>();
17
41
  }