@alextheman/utility 1.5.0 → 1.5.2

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/index.d.mts CHANGED
@@ -10,4 +10,6 @@ declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
10
10
 
11
11
  declare function truncate(stringToTruncate: string, maxLength?: number): string;
12
12
 
13
- export { addDaysToDate, formatDateAndTime, getRandomNumber, randomiseArray, truncate, wait };
13
+ declare function appendSemicolon(stringToAppendTo: string): string;
14
+
15
+ export { addDaysToDate, appendSemicolon, formatDateAndTime, getRandomNumber, randomiseArray, truncate, wait };
package/dist/index.d.ts CHANGED
@@ -10,4 +10,6 @@ declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
10
10
 
11
11
  declare function truncate(stringToTruncate: string, maxLength?: number): string;
12
12
 
13
- export { addDaysToDate, formatDateAndTime, getRandomNumber, randomiseArray, truncate, wait };
13
+ declare function appendSemicolon(stringToAppendTo: string): string;
14
+
15
+ export { addDaysToDate, appendSemicolon, formatDateAndTime, getRandomNumber, randomiseArray, truncate, wait };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  addDaysToDate: () => add_days_to_date_default,
24
+ appendSemicolon: () => append_semicolon_default,
24
25
  formatDateAndTime: () => format_date_and_time_default,
25
26
  getRandomNumber: () => get_random_number_default,
26
27
  randomiseArray: () => randomise_array_default,
@@ -88,9 +89,23 @@ function truncate(stringToTruncate, maxLength = 5) {
88
89
  return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
89
90
  }
90
91
  var truncate_default = truncate;
92
+
93
+ // src/append-semicolon.ts
94
+ function appendSemicolon(stringToAppendTo) {
95
+ if (stringToAppendTo.includes("\n")) {
96
+ throw new Error("MULTIPLE_LINE_ERROR");
97
+ }
98
+ const stringWithNoTrailingWhitespace = stringToAppendTo.trimEnd();
99
+ if (stringWithNoTrailingWhitespace === "") {
100
+ return "";
101
+ }
102
+ return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
103
+ }
104
+ var append_semicolon_default = appendSemicolon;
91
105
  // Annotate the CommonJS export names for ESM import in node:
92
106
  0 && (module.exports = {
93
107
  addDaysToDate,
108
+ appendSemicolon,
94
109
  formatDateAndTime,
95
110
  getRandomNumber,
96
111
  randomiseArray,
package/dist/index.mjs CHANGED
@@ -57,8 +57,22 @@ function truncate(stringToTruncate, maxLength = 5) {
57
57
  return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
58
58
  }
59
59
  var truncate_default = truncate;
60
+
61
+ // src/append-semicolon.ts
62
+ function appendSemicolon(stringToAppendTo) {
63
+ if (stringToAppendTo.includes("\n")) {
64
+ throw new Error("MULTIPLE_LINE_ERROR");
65
+ }
66
+ const stringWithNoTrailingWhitespace = stringToAppendTo.trimEnd();
67
+ if (stringWithNoTrailingWhitespace === "") {
68
+ return "";
69
+ }
70
+ return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
71
+ }
72
+ var append_semicolon_default = appendSemicolon;
60
73
  export {
61
74
  add_days_to_date_default as addDaysToDate,
75
+ append_semicolon_default as appendSemicolon,
62
76
  format_date_and_time_default as formatDateAndTime,
63
77
  get_random_number_default as getRandomNumber,
64
78
  randomise_array_default as randomiseArray,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",