namirasoft-core 1.4.51 → 1.4.53

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.
@@ -0,0 +1,6 @@
1
+ import { IStorage } from "./IStorage.js";
2
+ export declare class IStorageSession extends IStorage {
3
+ get(name: string, defaultValue: string): string;
4
+ set(name: string, value: string): void;
5
+ del(name: string): void;
6
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IStorageSession = void 0;
4
+ const IStorage_js_1 = require("./IStorage.js");
5
+ class IStorageSession extends IStorage_js_1.IStorage {
6
+ get(name, defaultValue) {
7
+ var _a;
8
+ return (_a = sessionStorage.getItem(name)) !== null && _a !== void 0 ? _a : defaultValue;
9
+ }
10
+ set(name, value) {
11
+ sessionStorage.setItem(name, value);
12
+ }
13
+ del(name) {
14
+ sessionStorage.removeItem(name);
15
+ }
16
+ }
17
+ exports.IStorageSession = IStorageSession;
18
+ //# sourceMappingURL=IStorageSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IStorageSession.js","sourceRoot":"","sources":["../src/IStorageSession.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AAEzC,MAAa,eAAgB,SAAQ,sBAAQ;IAEhC,GAAG,CAAC,IAAY,EAAE,YAAoB;;QAE3C,OAAO,MAAA,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,mCAAI,YAAY,CAAC;IACxD,CAAC;IACQ,GAAG,CAAC,IAAY,EAAE,KAAa;QAEpC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACQ,GAAG,CAAC,IAAY;QAErB,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACJ;AAdD,0CAcC"}
@@ -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
  }
@@ -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
- return Math.round(value / 1000) / 100;
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;QAEzB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IAC1C,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;AAlBD,wCAkBC"}
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/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export * from "./IStorageCookie";
28
28
  export * from "./IStorageJsonFile";
29
29
  export * from "./IStorageLocal";
30
30
  export * from "./IStorageMemory";
31
+ export * from "./IStorageSession";
31
32
  export * from "./NamingConvention";
32
33
  export * from "./ObjectService";
33
34
  export * from "./PackageService";
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ __exportStar(require("./IStorageCookie"), exports);
44
44
  __exportStar(require("./IStorageJsonFile"), exports);
45
45
  __exportStar(require("./IStorageLocal"), exports);
46
46
  __exportStar(require("./IStorageMemory"), exports);
47
+ __exportStar(require("./IStorageSession"), exports);
47
48
  __exportStar(require("./NamingConvention"), exports);
48
49
  __exportStar(require("./ObjectService"), exports);
49
50
  __exportStar(require("./PackageService"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,+CAA6B;AAC7B,6CAA2B;AAC3B,iDAA+B;AAC/B,qDAAmC;AACnC,kDAAgC;AAChC,8CAA4B;AAC5B,mDAAiC;AACjC,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,yDAAuC;AACvC,uDAAqC;AACrC,iDAA+B;AAC/B,kDAAgC;AAChC,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,oDAAkC;AAClC,6CAA2B;AAC3B,oDAAkC;AAClC,kDAAgC;AAChC,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,+CAA6B;AAC7B,6CAA2B;AAC3B,iDAA+B;AAC/B,qDAAmC;AACnC,kDAAgC;AAChC,8CAA4B;AAC5B,mDAAiC;AACjC,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,yDAAuC;AACvC,uDAAqC;AACrC,iDAA+B;AAC/B,kDAAgC;AAChC,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,oDAAkC;AAClC,6CAA2B;AAC3B,oDAAkC;AAClC,kDAAgC;AAChC,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.51",
11
+ "version": "1.4.53",
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.1",
21
- "axios": "^1.7.9",
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.5"
25
+ "uuid": "^11.1.0"
26
26
  }
27
27
  }
@@ -0,0 +1,17 @@
1
+ import { IStorage } from "./IStorage.js";
2
+
3
+ export class IStorageSession extends IStorage
4
+ {
5
+ override get(name: string, defaultValue: string)
6
+ {
7
+ return sessionStorage.getItem(name) ?? defaultValue;
8
+ }
9
+ override set(name: string, value: string)
10
+ {
11
+ sessionStorage.setItem(name, value);
12
+ }
13
+ override del(name: string)
14
+ {
15
+ sessionStorage.removeItem(name);
16
+ }
17
+ }
@@ -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
- return Math.round(value / 1000) / 100;
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
  {
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ export * from "./IStorageCookie";
28
28
  export * from "./IStorageJsonFile";
29
29
  export * from "./IStorageLocal";
30
30
  export * from "./IStorageMemory";
31
+ export * from "./IStorageSession";
31
32
  export * from "./NamingConvention";
32
33
  export * from "./ObjectService";
33
34
  export * from "./PackageService";