@8ms/helpers 2.3.44 → 2.3.46

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.
@@ -13,7 +13,7 @@ declare const logLevel: {
13
13
  type LogLevel = typeof logLevel[keyof typeof logLevel];
14
14
  type LogEvent = {
15
15
  timestamp: InputDate;
16
- event: string | object;
16
+ data: string | object;
17
17
  };
18
18
  //#endregion
19
19
  //#region src/aws/cloudWatchLog/server/AwsCloudWatchLogNamespace.d.ts
@@ -70,7 +70,7 @@ var AwsCloudWatchLogNamespace = class extends BaseNamespace {
70
70
  logStreamName,
71
71
  logEvents: logEvents.map((event) => ({
72
72
  timestamp: getLuxonDate(event.timestamp).toMillis(),
73
- message: typeof event === "string" ? event : JSON.stringify(event)
73
+ message: typeof event.data === "string" ? event.data : JSON.stringify(event.data)
74
74
  }))
75
75
  }));
76
76
  };
@@ -2,20 +2,20 @@
2
2
  /**
3
3
  * Take a given number and format as a compact number.
4
4
  */
5
- declare const formatCompact: (input: any, maxDp?: number, minDp?: number) => string;
5
+ declare const formatCompact: (input: any, minDp?: number, maxDp?: number) => string;
6
6
  //#endregion
7
7
  //#region src/number/formatCurrency.d.ts
8
8
  /**
9
9
  * Use the International number formatting to return the currency value.
10
10
  * https://www.freecodecamp.org/news/how-to-format-number-as-currency-in-javascript-one-line-of-code/
11
11
  */
12
- declare const formatCurrency: (input: any, currency?: string, maxDp?: number, minDp?: number) => string;
12
+ declare const formatCurrency: (input: any, currency?: string, minDp?: number, maxDp?: number) => string;
13
13
  //#endregion
14
14
  //#region src/number/formatStandard.d.ts
15
15
  /**
16
16
  * Take a given number and format it.
17
17
  */
18
- declare const formatStandard: (input: any, maxDp?: number, minDp?: number) => string;
18
+ declare const formatStandard: (input: any, minDp?: number, maxDp?: number) => string;
19
19
  //#endregion
20
20
  //#region src/number/getDecimal.d.ts
21
21
  /**
@@ -4,13 +4,11 @@ import { n as getNumber, t as getDecimal } from "../getDecimal-CafxtLhH.mjs";
4
4
  /**
5
5
  * Take a given number and format as a compact number.
6
6
  */
7
- const formatCompact = (input, maxDp, minDp) => {
7
+ const formatCompact = (input, minDp, maxDp) => {
8
8
  const inputValue = getNumber(input);
9
- const maximumDp = maxDp ?? 2;
10
- const minimumDp = minDp ?? maxDp;
11
9
  return Intl.NumberFormat(void 0, {
12
- minimumFractionDigits: maximumDp,
13
- maximumFractionDigits: minimumDp,
10
+ minimumFractionDigits: minDp || 0,
11
+ maximumFractionDigits: maxDp || minDp || 0,
14
12
  notation: "compact"
15
13
  }).format(inputValue);
16
14
  };
@@ -21,16 +19,14 @@ const formatCompact = (input, maxDp, minDp) => {
21
19
  * Use the International number formatting to return the currency value.
22
20
  * https://www.freecodecamp.org/news/how-to-format-number-as-currency-in-javascript-one-line-of-code/
23
21
  */
24
- const formatCurrency = (input, currency = "GBP", maxDp, minDp) => {
22
+ const formatCurrency = (input, currency = "GBP", minDp, maxDp) => {
25
23
  const value = Number(input);
26
24
  const currencyClean = currency.toUpperCase().trim();
27
- const maximumDp = maxDp ?? 2;
28
- const minimumDp = minDp ?? maxDp;
29
25
  let formatted = new Intl.NumberFormat(void 0, {
30
26
  style: "currency",
31
27
  currency: currencyClean,
32
- minimumFractionDigits: maximumDp,
33
- maximumFractionDigits: minimumDp
28
+ minimumFractionDigits: minDp || 0,
29
+ maximumFractionDigits: maxDp || minDp || 0
34
30
  }).format(value);
35
31
  if ("USD" === currencyClean) formatted = formatted.replace("US$", "$");
36
32
  return formatted;
@@ -41,13 +37,11 @@ const formatCurrency = (input, currency = "GBP", maxDp, minDp) => {
41
37
  /**
42
38
  * Take a given number and format it.
43
39
  */
44
- const formatStandard = (input, maxDp, minDp) => {
40
+ const formatStandard = (input, minDp, maxDp) => {
45
41
  const inputValue = getNumber(input);
46
- const maximumDp = maxDp ?? 0;
47
- const minimumDp = minDp ?? maxDp;
48
42
  return Intl.NumberFormat(void 0, {
49
- minimumFractionDigits: maximumDp,
50
- maximumFractionDigits: minimumDp,
43
+ minimumFractionDigits: minDp || 0,
44
+ maximumFractionDigits: maxDp || minDp || 0,
51
45
  notation: "standard"
52
46
  }).format(inputValue);
53
47
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.3.44",
4
+ "version": "2.3.46",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"