eservices-core 1.0.497 → 1.0.498
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.ts +2 -0
- package/dist/index.js +19 -3
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/pretty-value.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ import staticLink from "./utils/static-link";
|
|
|
56
56
|
import groupArrayByField from "./utils/group-array-by-field";
|
|
57
57
|
import uuidv4 from "./utils/uuid";
|
|
58
58
|
import Request from "./utils/Request";
|
|
59
|
+
import { prettyMoney } from "./utils/pretty-value";
|
|
59
60
|
import parseError from "./utils/parse-error";
|
|
60
61
|
import useFormMetadata from "./hooks/use-form-metadata";
|
|
61
62
|
import useFormAction from "./hooks/use-form-action";
|
|
@@ -102,6 +103,7 @@ declare const utils: {
|
|
|
102
103
|
groupArrayByField: typeof groupArrayByField;
|
|
103
104
|
uuidv4: typeof uuidv4;
|
|
104
105
|
Request: typeof _utils.Request;
|
|
106
|
+
prettyMoney: typeof prettyMoney;
|
|
105
107
|
};
|
|
106
108
|
export { utils, Request };
|
|
107
109
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* eservices-core v1.0.
|
|
2
|
+
* eservices-core v1.0.498
|
|
3
3
|
* (c) 2023 ESERVICES
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -2203,6 +2203,20 @@ function valuesToUpperCase(values) {
|
|
|
2203
2203
|
}, {});
|
|
2204
2204
|
}
|
|
2205
2205
|
|
|
2206
|
+
function prettyMoney(value, countPrecision = 2) {
|
|
2207
|
+
if (!(typeof value === 'string' || typeof value === 'number'))
|
|
2208
|
+
return '';
|
|
2209
|
+
const strValue = String(value);
|
|
2210
|
+
let parts = strValue.split(".");
|
|
2211
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
2212
|
+
if (parts.length < 2)
|
|
2213
|
+
parts[1] = "";
|
|
2214
|
+
parts[1] = parts[1].padEnd(countPrecision, "0");
|
|
2215
|
+
if (parts[1].length > countPrecision)
|
|
2216
|
+
parts[1] = parts[1].substring(0, countPrecision);
|
|
2217
|
+
return parts.join(".");
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2206
2220
|
const utils$1 = {
|
|
2207
2221
|
Request,
|
|
2208
2222
|
clickOutside,
|
|
@@ -2211,7 +2225,8 @@ const utils$1 = {
|
|
|
2211
2225
|
GraphQL,
|
|
2212
2226
|
firstChapterToLowerCase,
|
|
2213
2227
|
requestHandler,
|
|
2214
|
-
valuesToUpperCase
|
|
2228
|
+
valuesToUpperCase,
|
|
2229
|
+
prettyMoney
|
|
2215
2230
|
};
|
|
2216
2231
|
|
|
2217
2232
|
var _utils = /*#__PURE__*/Object.freeze({
|
|
@@ -5616,7 +5631,8 @@ const utils = {
|
|
|
5616
5631
|
staticLink,
|
|
5617
5632
|
groupArrayByField,
|
|
5618
5633
|
uuidv4,
|
|
5619
|
-
Request
|
|
5634
|
+
Request,
|
|
5635
|
+
prettyMoney
|
|
5620
5636
|
};
|
|
5621
5637
|
var index = {
|
|
5622
5638
|
widgets: a,
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import Journal from "./Journal";
|
|
|
7
7
|
import firstChapterToLowerCase from "./firstChapterToLowerCase";
|
|
8
8
|
import requestHandler from "./requestHandler";
|
|
9
9
|
import valuesToUpperCase from "./values-to-upper-case";
|
|
10
|
+
import { prettyMoney } from "./pretty-value";
|
|
10
11
|
export { Request, clickOutside, getPropFromObject, runPromiseQueue, GraphQL, Journal, firstChapterToLowerCase, requestHandler, valuesToUpperCase };
|
|
11
12
|
declare const utils: {
|
|
12
13
|
Request: typeof Request;
|
|
@@ -17,5 +18,6 @@ declare const utils: {
|
|
|
17
18
|
firstChapterToLowerCase: typeof firstChapterToLowerCase;
|
|
18
19
|
requestHandler: typeof requestHandler;
|
|
19
20
|
valuesToUpperCase: typeof valuesToUpperCase;
|
|
21
|
+
prettyMoney: typeof prettyMoney;
|
|
20
22
|
};
|
|
21
23
|
export default utils;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prettyMoney(value: unknown, countPrecision?: number): string;
|