namirasoft-core 1.4.51 → 1.4.52
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/PriceOperation.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class PriceOperation {
|
|
2
2
|
static toCent(value: number): number;
|
|
3
|
-
static toNormal(value: number): number;
|
|
3
|
+
static toNormal(value: number, decimal?: number): number;
|
|
4
4
|
static fromCent(value: number): number;
|
|
5
5
|
static fromNormal(value: number): number;
|
|
6
6
|
}
|
package/dist/PriceOperation.js
CHANGED
|
@@ -5,8 +5,10 @@ class PriceOperation {
|
|
|
5
5
|
static toCent(value) {
|
|
6
6
|
return Math.round(value / 1000);
|
|
7
7
|
}
|
|
8
|
-
static toNormal(value) {
|
|
9
|
-
|
|
8
|
+
static toNormal(value, decimal = 2) {
|
|
9
|
+
let thousand = Math.max(5 - decimal, 0);
|
|
10
|
+
let hundred = 5 - thousand;
|
|
11
|
+
return Math.round(value / Math.pow(10, thousand)) / Math.pow(10, hundred);
|
|
10
12
|
}
|
|
11
13
|
static fromCent(value) {
|
|
12
14
|
return Math.floor(value * 1000);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceOperation.js","sourceRoot":"","sources":["../src/PriceOperation.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IAEvB,MAAM,CAAC,MAAM,CAAC,KAAa;QAEvB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,KAAa;
|
|
1
|
+
{"version":3,"file":"PriceOperation.js","sourceRoot":"","sources":["../src/PriceOperation.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IAEvB,MAAM,CAAC,MAAM,CAAC,KAAa;QAEvB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,KAAa,EAAE,UAAkB,CAAC;QAE9C,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;QACxC,IAAI,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,CAAC,QAAQ,CAAC,KAAa;QAEzB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,CAAC,UAAU,CAAC,KAAa;QAE3B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ;AApBD,wCAoBC"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.52",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/index.js",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"build": ""
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/node": "^22.13.
|
|
21
|
-
"axios": "^1.
|
|
20
|
+
"@types/node": "^22.13.9",
|
|
21
|
+
"axios": "^1.8.1",
|
|
22
22
|
"buffer": "^6.0.3",
|
|
23
23
|
"moment": "^2.30.1",
|
|
24
24
|
"phone": "^3.1.58",
|
|
25
|
-
"uuid": "^11.0
|
|
25
|
+
"uuid": "^11.1.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/PriceOperation.ts
CHANGED
|
@@ -4,9 +4,11 @@ export class PriceOperation
|
|
|
4
4
|
{
|
|
5
5
|
return Math.round(value / 1000);
|
|
6
6
|
}
|
|
7
|
-
static toNormal(value: number): number
|
|
7
|
+
static toNormal(value: number, decimal: number = 2): number
|
|
8
8
|
{
|
|
9
|
-
|
|
9
|
+
let thousand = Math.max(5 - decimal, 0);
|
|
10
|
+
let hundred = 5 - thousand;
|
|
11
|
+
return Math.round(value / Math.pow(10, thousand)) / Math.pow(10, hundred);
|
|
10
12
|
}
|
|
11
13
|
static fromCent(value: number): number
|
|
12
14
|
{
|