@onereach/billing-shared 11.32.2-beta.2830.0 → 11.33.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/dist/cjs/utils/index.js +5 -15
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/roundToTwoDecimals.js +7 -0
- package/dist/cjs/utils/roundToTwoDecimals.js.map +1 -0
- package/dist/esm/utils/index.js +1 -2
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/roundToTwoDecimals.js +4 -0
- package/dist/esm/utils/roundToTwoDecimals.js.map +1 -0
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/roundToTwoDecimals.d.ts +2 -0
- package/dist/types/utils/roundToTwoDecimals.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/utils/index.ts +1 -2
- package/src/utils/roundToTwoDecimals.ts +6 -0
- package/dist/cjs/utils/date.js +0 -8
- package/dist/cjs/utils/date.js.map +0 -1
- package/dist/cjs/utils/math.js +0 -19
- package/dist/cjs/utils/math.js.map +0 -1
- package/dist/esm/utils/date.js +0 -5
- package/dist/esm/utils/date.js.map +0 -1
- package/dist/esm/utils/math.js +0 -14
- package/dist/esm/utils/math.js.map +0 -1
- package/dist/types/utils/date.d.ts +0 -2
- package/dist/types/utils/date.d.ts.map +0 -1
- package/dist/types/utils/math.d.ts +0 -3
- package/dist/types/utils/math.d.ts.map +0 -1
- package/src/utils/date.ts +0 -13
- package/src/utils/math.ts +0 -35
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
exports.roundToTwoDecimals = void 0;
|
|
7
|
+
var roundToTwoDecimals_1 = require("./roundToTwoDecimals");
|
|
8
|
+
Object.defineProperty(exports, "roundToTwoDecimals", { enumerable: true, get: function () { return __importDefault(roundToTwoDecimals_1).default; } });
|
|
19
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAqE;AAA5D,yIAAA,OAAO,OAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundToTwoDecimals.js","sourceRoot":"","sources":["../../../src/utils/roundToTwoDecimals.ts"],"names":[],"mappings":";;AAGA,qCAEC;AAFD,SAAwB,kBAAkB,CAAC,KAAa;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundToTwoDecimals.js","sourceRoot":"","sources":["../../../src/utils/roundToTwoDecimals.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAa;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundToTwoDecimals.d.ts","sourceRoot":"","sources":["../../../src/utils/roundToTwoDecimals.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/package.json
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './date';
|
|
1
|
+
export { default as roundToTwoDecimals } from './roundToTwoDecimals';
|
package/dist/cjs/utils/date.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatDateToString = formatDateToString;
|
|
4
|
-
function formatDateToString(date) {
|
|
5
|
-
var targetDate = date || new Date();
|
|
6
|
-
return targetDate.toISOString().split('T')[0];
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=date.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":";;AASA,gDAGC;AAHD,SAAgB,kBAAkB,CAAC,IAAW;IAC5C,IAAM,UAAU,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;IACtC,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/cjs/utils/math.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.round = round;
|
|
4
|
-
exports.roundToTwoDecimals = roundToTwoDecimals;
|
|
5
|
-
function round(value, decimalPlaces) {
|
|
6
|
-
if (decimalPlaces === void 0) { decimalPlaces = 2; }
|
|
7
|
-
if (!Number.isFinite(value)) {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
if (!Number.isInteger(decimalPlaces) || decimalPlaces < 0) {
|
|
11
|
-
throw new Error('decimalPlaces must be a non-negative integer');
|
|
12
|
-
}
|
|
13
|
-
var multiplier = Math.pow(10, decimalPlaces);
|
|
14
|
-
return Math.round(value * multiplier) / multiplier;
|
|
15
|
-
}
|
|
16
|
-
function roundToTwoDecimals(value) {
|
|
17
|
-
return round(value, 2);
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=math.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../../src/utils/math.ts"],"names":[],"mappings":";;AAUA,sBAWC;AAWD,gDAEC;AAxBD,SAAgB,KAAK,CAAC,KAAa,EAAE,aAAyB;IAAzB,8BAAA,EAAA,iBAAyB;IAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,IAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;AACrD,CAAC;AAWD,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC"}
|
package/dist/esm/utils/date.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAAC,IAAW;IAC5C,MAAM,UAAU,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;IACtC,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/esm/utils/math.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function round(value, decimalPlaces = 2) {
|
|
2
|
-
if (!Number.isFinite(value)) {
|
|
3
|
-
return value;
|
|
4
|
-
}
|
|
5
|
-
if (!Number.isInteger(decimalPlaces) || decimalPlaces < 0) {
|
|
6
|
-
throw new Error('decimalPlaces must be a non-negative integer');
|
|
7
|
-
}
|
|
8
|
-
const multiplier = Math.pow(10, decimalPlaces);
|
|
9
|
-
return Math.round(value * multiplier) / multiplier;
|
|
10
|
-
}
|
|
11
|
-
export function roundToTwoDecimals(value) {
|
|
12
|
-
return round(value, 2);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=math.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../../src/utils/math.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,gBAAwB,CAAC;IAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;AACrD,CAAC;AAWD,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AASA,wBAAgB,kBAAkB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAGtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/utils/math.ts"],"names":[],"mappings":"AAUA,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,MAAU,GAAG,MAAM,CAWtE;AAWD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
package/src/utils/date.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a Date object to YYYY-MM-DD string format
|
|
3
|
-
* Uses ISO string format and extracts only the date portion
|
|
4
|
-
* @param date The date to format (defaults to current date if not provided)
|
|
5
|
-
* @returns Date string in YYYY-MM-DD format
|
|
6
|
-
* @example
|
|
7
|
-
* formatDateToString() // returns current date like "2024-03-15"
|
|
8
|
-
* formatDateToString(new Date(2024, 0, 1)) // returns "2024-01-01"
|
|
9
|
-
*/
|
|
10
|
-
export function formatDateToString(date?: Date): string {
|
|
11
|
-
const targetDate = date || new Date();
|
|
12
|
-
return targetDate.toISOString().split('T')[0];
|
|
13
|
-
}
|
package/src/utils/math.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rounds a number to a specified number of decimal places
|
|
3
|
-
* @param value The number to round
|
|
4
|
-
* @param decimalPlaces The number of decimal places to round to (default: 2)
|
|
5
|
-
* @returns The rounded number
|
|
6
|
-
* @throws Error if decimalPlaces is not a non-negative integer
|
|
7
|
-
* @example
|
|
8
|
-
* round(3.14159, 2) // returns 3.14
|
|
9
|
-
* round(123.456789, 4) // returns 123.4568
|
|
10
|
-
*/
|
|
11
|
-
export function round(value: number, decimalPlaces: number = 2): number {
|
|
12
|
-
if (!Number.isFinite(value)) {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (!Number.isInteger(decimalPlaces) || decimalPlaces < 0) {
|
|
17
|
-
throw new Error('decimalPlaces must be a non-negative integer');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const multiplier = Math.pow(10, decimalPlaces);
|
|
21
|
-
return Math.round(value * multiplier) / multiplier;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Rounds a number to exactly 2 decimal places
|
|
26
|
-
* Commonly used for currency calculations in the billing system
|
|
27
|
-
* @param value The number to round
|
|
28
|
-
* @returns The number rounded to 2 decimal places
|
|
29
|
-
* @example
|
|
30
|
-
* roundToTwoDecimals(3.14159) // returns 3.14
|
|
31
|
-
* roundToTwoDecimals(125.999) // returns 126.00
|
|
32
|
-
*/
|
|
33
|
-
export function roundToTwoDecimals(value: number): number {
|
|
34
|
-
return round(value, 2);
|
|
35
|
-
}
|