@abaplint/runtime 2.0.4 → 2.0.5

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,6 @@
1
+ import { DecFloat34, Float } from "../types";
1
2
  import { ICharacter } from "../types/_character";
2
3
  import { INumeric } from "../types/_numeric";
3
4
  export declare function frac(input: {
4
5
  val: number | string | ICharacter | INumeric;
5
- }): number;
6
+ }): number | Float | DecFloat34;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.frac = void 0;
4
+ /* eslint-disable radix */
5
+ const types_1 = require("../types");
4
6
  function frac(input) {
5
7
  let num_in = undefined;
6
8
  let ret = 0;
@@ -11,6 +13,10 @@ function frac(input) {
11
13
  else if (typeof input.val === "string") {
12
14
  num_in = parseFloat(input.val);
13
15
  }
16
+ else if (input.val instanceof types_1.DecFloat34
17
+ || input.val instanceof types_1.Float) {
18
+ num_in = input.val.getRaw();
19
+ }
14
20
  else {
15
21
  num_in = parseFloat(input.val.get().toString());
16
22
  }
@@ -21,7 +27,15 @@ function frac(input) {
21
27
  }
22
28
  ret = parseFloat(pre + numSplit[1]);
23
29
  }
24
- return ret;
30
+ if (input.val instanceof types_1.DecFloat34) {
31
+ return new types_1.DecFloat34().set(ret);
32
+ }
33
+ else if (input.val instanceof types_1.Float) {
34
+ return new types_1.Float().set(ret);
35
+ }
36
+ else {
37
+ return ret;
38
+ }
25
39
  }
26
40
  exports.frac = frac;
27
41
  //# sourceMappingURL=frac.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/runtime",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Transpiler - Runtime",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/src/index.d.ts",