@abaplint/runtime 2.13.44 → 2.13.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,5 +13,5 @@ type options = {
13
13
  alphaInContext?: any;
14
14
  align?: "left" | "right";
15
15
  };
16
- export declare function templateFormatting(source: ICharacter | INumeric, options?: options): string;
16
+ export declare function templateFormatting(source: ICharacter | INumeric | number | string, options?: options): string;
17
17
  export {};
@@ -50,14 +50,24 @@ function templateFormatting(source, options) {
50
50
  text = source.toFixed(source.getDecimals());
51
51
  }
52
52
  }
53
+ else if (typeof source === "number" || typeof source === "string") {
54
+ text = source + "";
55
+ }
53
56
  else {
54
57
  text = source.get() + "";
55
58
  }
56
59
  if (options?.alpha === "out") {
57
- text = (0, alpha_1.alphaOut)(source);
60
+ if (typeof source === "number" || typeof source === "string") {
61
+ text = text.replace(/^0+/, "");
62
+ }
63
+ else {
64
+ text = (0, alpha_1.alphaOut)(source);
65
+ }
58
66
  }
59
67
  else if (options?.alpha === "in") {
60
- text = (0, alpha_1.alphaIn)(source, options.alphaInContext);
68
+ if (typeof source !== "number" && typeof source !== "string") {
69
+ text = (0, alpha_1.alphaIn)(source, options.alphaInContext);
70
+ }
61
71
  }
62
72
  if (options) {
63
73
  if (options.currency !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.13.44",
3
+ "version": "2.13.46",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",