namirasoft-core 1.2.13 → 1.2.15

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.
@@ -1,24 +1,24 @@
1
- import { ConvertService } from "./ConvertService";
2
- import { ParsedNameValue } from "./ParsedNameValue";
3
-
4
- export class ObjectService extends ConvertService
5
- {
6
- private object: ParsedNameValue;
7
- constructor(object: ParsedNameValue, mandatory: boolean = false)
8
- {
9
- super(mandatory);
10
- this.object = object;
11
- }
12
- override getNullString()
13
- {
14
- let ans: string | null = null;
15
- if (Array.isArray(this.object))
16
- {
17
- if (this.object.length > 0)
18
- ans = this.object[0];
19
- }
20
- else if (this.object != null && this.object != undefined)
21
- ans = this.object + "";
22
- return ans;
23
- }
1
+ import { ConvertService } from "./ConvertService";
2
+ import { ParsedNameValue } from "./ParsedNameValue";
3
+
4
+ export class ObjectService extends ConvertService
5
+ {
6
+ private object: ParsedNameValue;
7
+ constructor(object: ParsedNameValue, mandatory: boolean = false)
8
+ {
9
+ super(mandatory);
10
+ this.object = object;
11
+ }
12
+ override getNullString()
13
+ {
14
+ let ans: string | null = null;
15
+ if (Array.isArray(this.object))
16
+ {
17
+ if (this.object.length > 0)
18
+ ans = this.object[0];
19
+ }
20
+ else if (this.object != null && this.object != undefined)
21
+ ans = this.object + "";
22
+ return ans;
23
+ }
24
24
  }
@@ -1,67 +1,67 @@
1
- let fs: any;
2
- if (typeof window === 'undefined')
3
- fs = require('fs');
4
- import { FileOperation } from "./FileOperation";
5
-
6
- export class PackageService
7
- {
8
- static get(path: string): PackageService
9
- {
10
- if (path)
11
- {
12
- const json = JSON.parse(fs.readFileSync(path, 'utf8'));
13
- if (json)
14
- return new PackageService(path, json);
15
- }
16
- throw new Error("Coundn't find package");
17
- }
18
- static getMain(): PackageService
19
- {
20
- const paths = FileOperation.findUp('package.json');
21
- if (paths)
22
- return this.get(paths[paths.length - 1]);
23
- throw new Error("Coundn't find package");
24
- }
25
- static getThis(): PackageService
26
- {
27
- const paths = FileOperation.findUp('package.json');
28
- if (paths)
29
- return this.get(paths[0]);
30
- throw new Error("Coundn't find package");
31
- }
32
- private path: string;
33
- private json: any;
34
- constructor(path: string, json: any)
35
- {
36
- this.json = json;
37
- this.path = path;
38
- }
39
- getPath(): string
40
- {
41
- return this.path;
42
- }
43
- getName(): string
44
- {
45
- return this.json.name;
46
- }
47
- getTitle(): string
48
- {
49
- return this.json.title;
50
- }
51
- getDescription(): string
52
- {
53
- return this.json.description;
54
- }
55
- getIcon(): string
56
- {
57
- return this.json.icon;
58
- }
59
- getLogo(): string
60
- {
61
- return this.json.logo;
62
- }
63
- getVersion(): string
64
- {
65
- return this.json.version;
66
- }
1
+ let fs: any;
2
+ if (typeof window === 'undefined')
3
+ fs = require('fs');
4
+ import { FileOperation } from "./FileOperation";
5
+
6
+ export class PackageService
7
+ {
8
+ static get(path: string): PackageService
9
+ {
10
+ if (path)
11
+ {
12
+ const json = JSON.parse(fs.readFileSync(path, 'utf8'));
13
+ if (json)
14
+ return new PackageService(path, json);
15
+ }
16
+ throw new Error("Coundn't find package");
17
+ }
18
+ static getMain(): PackageService
19
+ {
20
+ const paths = FileOperation.findUp('package.json');
21
+ if (paths)
22
+ return this.get(paths[paths.length - 1]);
23
+ throw new Error("Coundn't find package");
24
+ }
25
+ static getThis(): PackageService
26
+ {
27
+ const paths = FileOperation.findUp('package.json');
28
+ if (paths)
29
+ return this.get(paths[0]);
30
+ throw new Error("Coundn't find package");
31
+ }
32
+ private path: string;
33
+ private json: any;
34
+ constructor(path: string, json: any)
35
+ {
36
+ this.json = json;
37
+ this.path = path;
38
+ }
39
+ getPath(): string
40
+ {
41
+ return this.path;
42
+ }
43
+ getName(): string
44
+ {
45
+ return this.json.name;
46
+ }
47
+ getTitle(): string
48
+ {
49
+ return this.json.title;
50
+ }
51
+ getDescription(): string
52
+ {
53
+ return this.json.description;
54
+ }
55
+ getIcon(): string
56
+ {
57
+ return this.json.icon;
58
+ }
59
+ getLogo(): string
60
+ {
61
+ return this.json.logo;
62
+ }
63
+ getVersion(): string
64
+ {
65
+ return this.json.version;
66
+ }
67
67
  }
@@ -1,9 +1,9 @@
1
- import * as Phone from 'phone';
2
-
3
- export class PhoneOperation
4
- {
5
- static isValid(number: string): boolean
6
- {
7
- return Phone.phone(number).isValid;
8
- }
1
+ import * as Phone from 'phone';
2
+
3
+ export class PhoneOperation
4
+ {
5
+ static isValid(number: string): boolean
6
+ {
7
+ return Phone.phone(number).isValid;
8
+ }
9
9
  }
@@ -1,19 +1,19 @@
1
- export class StringOperation
2
- {
3
- static format(string: string, ...args: string[]): string
4
- {
5
- return string.replace(/{(\d+)}/g, (match, index) =>
6
- {
7
- const arg = args[index];
8
- return typeof arg !== 'undefined' ? arg : match;
9
- });
10
- }
11
- static repair(value: string): string
12
- {
13
- if (value == null)
14
- value = '';
15
- value = value.replace(/\s\s+/gm, ' ');
16
- value = value.trim();
17
- return value;
18
- }
1
+ export class StringOperation
2
+ {
3
+ static format(string: string, ...args: string[]): string
4
+ {
5
+ return string.replace(/{(\d+)}/g, (match, index) =>
6
+ {
7
+ const arg = args[index];
8
+ return typeof arg !== 'undefined' ? arg : match;
9
+ });
10
+ }
11
+ static repair(value: string): string
12
+ {
13
+ if (value == null)
14
+ value = '';
15
+ value = value.replace(/\s\s+/gm, ' ');
16
+ value = value.trim();
17
+ return value;
18
+ }
19
19
  }