@8ms/helpers 1.38.0 → 1.39.0
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/package.json +1 -1
- package/prisma/getDecimal.js +10 -3
package/package.json
CHANGED
package/prisma/getDecimal.js
CHANGED
|
@@ -4,14 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const getDecimal_1 = __importDefault(require("../number/getDecimal"));
|
|
7
|
+
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
7
8
|
/**
|
|
8
9
|
* Fetch the number from a prisma decimal (comes through as an object).
|
|
9
10
|
*/
|
|
10
11
|
const getDecimal = (props) => {
|
|
11
|
-
let
|
|
12
|
-
|
|
12
|
+
let numberString = "";
|
|
13
|
+
// Prisma value
|
|
14
|
+
if ((0, isArray_1.default)(props?.input?.d)) {
|
|
15
|
+
numberString = props.input.absoluteValue();
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
numberString = props?.input.toString();
|
|
19
|
+
}
|
|
13
20
|
return (0, getDecimal_1.default)({
|
|
14
|
-
input:
|
|
21
|
+
input: numberString,
|
|
15
22
|
dp: props?.dp
|
|
16
23
|
});
|
|
17
24
|
};
|