@8ms/helpers 2.3.32 → 2.3.34

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,5 +1,5 @@
1
- import { BaseNamespace } from "../../../_class/index.mjs";
2
1
  import { u as ApiResponseClass } from "../../../api-DGKJDAfb.mjs";
2
+ import { BaseNamespace } from "../../../_class/index.mjs";
3
3
  import { n as isResponse200, t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
4
4
 
5
5
  //#region src/aws/lambda/server/AwsLambdaNamespace.ts
@@ -10,6 +10,12 @@ declare const getDecrypt: (appSalt: string, input: string, salt: string) => stri
10
10
  */
11
11
  declare const getEncrypt: (appSalt: string, input: string, salt: string) => string;
12
12
  //#endregion
13
+ //#region src/crypto/getMd5.d.ts
14
+ /**
15
+ * Encrypt a string using md5.
16
+ */
17
+ declare const getMd5: (input: any) => string;
18
+ //#endregion
13
19
  //#region src/crypto/getRandom.d.ts
14
20
  /**
15
21
  * Create a random string and return a number of characters from it.
@@ -22,4 +28,4 @@ declare const getRandom: (length: number) => string;
22
28
  */
23
29
  declare const getSha256: (input: any) => string;
24
30
  //#endregion
25
- export { getDecrypt, getEncrypt, getRandom, getSha256 };
31
+ export { getDecrypt, getEncrypt, getMd5, getRandom, getSha256 };
@@ -33,6 +33,17 @@ const getEncrypt = (appSalt, input, salt) => {
33
33
  return iv.toString("hex") + ":" + encrypted.toString("hex");
34
34
  };
35
35
 
36
+ //#endregion
37
+ //#region src/crypto/getMd5.ts
38
+ /**
39
+ * Encrypt a string using md5.
40
+ */
41
+ const getMd5 = (input) => {
42
+ const crypto = __require("crypto");
43
+ const inputString = getString(input);
44
+ return crypto.createHash("md5").update(inputString).digest("hex");
45
+ };
46
+
36
47
  //#endregion
37
48
  //#region src/crypto/getRandom.ts
38
49
  /**
@@ -54,4 +65,4 @@ const getSha256 = (input) => {
54
65
  };
55
66
 
56
67
  //#endregion
57
- export { getDecrypt, getEncrypt, getRandom, getSha256 };
68
+ export { getDecrypt, getEncrypt, getMd5, getRandom, getSha256 };
@@ -1,6 +1,6 @@
1
- import { BaseNamespace } from "../../_class/index.mjs";
2
1
  import "../../api-DGKJDAfb.mjs";
3
2
  import { get } from "../../axios/index.mjs";
3
+ import { BaseNamespace } from "../../_class/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
6
6
  //#region src/googlePageSpeed/server/GooglePageSpeedNamespace.ts
@@ -1,6 +1,6 @@
1
- import { BaseNamespace } from "../../_class/index.mjs";
2
1
  import "../../api-DGKJDAfb.mjs";
3
2
  import { get } from "../../axios/index.mjs";
3
+ import { BaseNamespace } from "../../_class/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
6
6
  //#region src/littleWarden/server/LittleWardenNamespace.ts
@@ -1,8 +1,8 @@
1
- //#region src/number/formatStandard.d.ts
1
+ //#region src/number/formatCompact.d.ts
2
2
  /**
3
- * Take a given number and format it.
3
+ * Take a given number and format as a compact number.
4
4
  */
5
- declare const formatStandard: (input: any, maxDp?: number, minDp?: number) => string;
5
+ declare const formatCompact: (input: any, maxDp?: number, minDp?: number) => string;
6
6
  //#endregion
7
7
  //#region src/number/formatCurrency.d.ts
8
8
  /**
@@ -11,6 +11,12 @@ declare const formatStandard: (input: any, maxDp?: number, minDp?: number) => st
11
11
  */
12
12
  declare const formatCurrency: (input: any, currency?: string, maxDp?: number, minDp?: number) => string;
13
13
  //#endregion
14
+ //#region src/number/formatStandard.d.ts
15
+ /**
16
+ * Take a given number and format it.
17
+ */
18
+ declare const formatStandard: (input: any, maxDp?: number, minDp?: number) => string;
19
+ //#endregion
14
20
  //#region src/number/getDecimal.d.ts
15
21
  /**
16
22
  * Return a decimal number after rounding.
@@ -44,4 +50,4 @@ declare const getNumber: (input: any, defaultValue?: number) => number;
44
50
  */
45
51
  declare const getPercentIncrease: (current: any, comparison: any, defaultValue: number) => number;
46
52
  //#endregion
47
- export { formatCurrency, formatStandard, getDecimal, getNumber, getPercent, getPercentIncrease, getSafeDivide };
53
+ export { formatCompact, formatCurrency, formatStandard, getDecimal, getNumber, getPercent, getPercentIncrease, getSafeDivide };
@@ -1,17 +1,17 @@
1
1
  import { n as getNumber, t as getDecimal } from "../getDecimal-CafxtLhH.mjs";
2
2
 
3
- //#region src/number/formatStandard.ts
3
+ //#region src/number/formatCompact.ts
4
4
  /**
5
- * Take a given number and format it.
5
+ * Take a given number and format as a compact number.
6
6
  */
7
- const formatStandard = (input, maxDp, minDp) => {
7
+ const formatCompact = (input, maxDp, minDp) => {
8
8
  const inputValue = getNumber(input);
9
- const maximumDp = maxDp ?? 0;
9
+ const maximumDp = maxDp ?? 2;
10
10
  const minimumDp = minDp ?? maxDp;
11
11
  return Intl.NumberFormat(void 0, {
12
12
  minimumFractionDigits: maximumDp,
13
13
  maximumFractionDigits: minimumDp,
14
- notation: "standard"
14
+ notation: "compact"
15
15
  }).format(inputValue);
16
16
  };
17
17
 
@@ -36,6 +36,22 @@ const formatCurrency = (input, currency = "GBP", maxDp, minDp) => {
36
36
  return formatted;
37
37
  };
38
38
 
39
+ //#endregion
40
+ //#region src/number/formatStandard.ts
41
+ /**
42
+ * Take a given number and format it.
43
+ */
44
+ const formatStandard = (input, maxDp, minDp) => {
45
+ const inputValue = getNumber(input);
46
+ const maximumDp = maxDp ?? 0;
47
+ const minimumDp = minDp ?? maxDp;
48
+ return Intl.NumberFormat(void 0, {
49
+ minimumFractionDigits: maximumDp,
50
+ maximumFractionDigits: minimumDp,
51
+ notation: "standard"
52
+ }).format(inputValue);
53
+ };
54
+
39
55
  //#endregion
40
56
  //#region src/number/getSafeDivide.ts
41
57
  /**
@@ -75,4 +91,4 @@ const getPercentIncrease = (current, comparison, defaultValue) => {
75
91
  };
76
92
 
77
93
  //#endregion
78
- export { formatCurrency, formatStandard, getDecimal, getNumber, getPercent, getPercentIncrease, getSafeDivide };
94
+ export { formatCompact, formatCurrency, formatStandard, getDecimal, getNumber, getPercent, getPercentIncrease, getSafeDivide };
@@ -1,6 +1,6 @@
1
- import { BaseNamespace } from "../../_class/index.mjs";
2
1
  import "../../api-DGKJDAfb.mjs";
3
2
  import { post } from "../../axios/index.mjs";
3
+ import { BaseNamespace } from "../../_class/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
6
6
  //#region src/openAi/server/OpenAiNamespace.ts
@@ -1,6 +1,6 @@
1
- import { BaseNamespace } from "../../_class/index.mjs";
2
1
  import "../../api-DGKJDAfb.mjs";
3
2
  import { post } from "../../axios/index.mjs";
3
+ import { BaseNamespace } from "../../_class/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
  import { DateTime } from "luxon";
6
6
 
@@ -1,6 +1,6 @@
1
- import { BaseNamespace } from "../../_class/index.mjs";
2
1
  import "../../api-DGKJDAfb.mjs";
3
2
  import { post } from "../../axios/index.mjs";
3
+ import { BaseNamespace } from "../../_class/index.mjs";
4
4
  import { onePasswordClient } from "../../onePassword/server/index.mjs";
5
5
 
6
6
  //#region src/upTimeRobot/server/UpTimeRobotNamespace.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.3.32",
4
+ "version": "2.3.34",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"