@smartsoft001/utils 2.45.0 → 2.47.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/.eslintrc.json CHANGED
@@ -15,11 +15,9 @@
15
15
  "rules": {}
16
16
  },
17
17
  {
18
- "files": ["*.json"],
18
+ "files": "package.json",
19
19
  "parser": "jsonc-eslint-parser",
20
- "rules": {
21
- "@nx/dependency-checks": "error"
22
- }
20
+ "rules": {}
23
21
  }
24
22
  ]
25
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/utils",
3
- "version": "2.45.0",
3
+ "version": "2.47.0",
4
4
  "dependencies": {
5
5
  "guid-typescript": "^1.0.9",
6
6
  "md5": "^2.3.0",
@@ -1,35 +1,34 @@
1
1
  export class NipService {
2
- /***
3
- * Check valid nip format
4
- * @param nip {string} - nip string
5
- * @return return true when correct
6
- */
7
- static isValid(nip: string): boolean {
8
- if(typeof nip !== 'string')
9
- return false;
2
+ /***
3
+ * Check valid nip format
4
+ * @param nip {string} - nip string
5
+ * @return return true when correct
6
+ */
7
+ static isValid(nip: string): boolean {
8
+ if (typeof nip !== 'string') return false;
10
9
 
11
- //eslint-disable-next-line
10
+ //eslint-disable-next-line
12
11
  nip = nip.replace(/[\ \-]/gi, '');
13
12
 
14
- const weight = [6, 5, 7, 2, 3, 4, 5, 6, 7];
15
- let sum = 0;
16
- // tslint:disable-next-line:radix
17
- const controlNumber = parseInt(nip.substring(9, 10));
18
- const weightCount = weight.length;
19
- for (let i = 0; i < weightCount; i++) {
20
- // tslint:disable-next-line:radix
21
- sum += (parseInt(nip.substr(i, 1)) * weight[i]);
22
- }
23
-
24
- return sum % 11 === controlNumber;
13
+ const weight = [6, 5, 7, 2, 3, 4, 5, 6, 7];
14
+ let sum = 0;
15
+ // tslint:disable-next-line:radix
16
+ const controlNumber = parseInt(nip.substring(9, 10));
17
+ const weightCount = weight.length;
18
+ for (let i = 0; i < weightCount; i++) {
19
+ // tslint:disable-next-line:radix
20
+ sum += parseInt(nip.substr(i, 1)) * weight[i];
25
21
  }
26
22
 
27
- /***
28
- * Check invalid nip format
29
- * @param nip {string} - nip string
30
- * @return return true when incorrect
31
- */
32
- static isInvalid(nip: string): boolean {
33
- return !NipService.isValid(nip);
34
- }
23
+ return sum % 11 === controlNumber;
24
+ }
25
+
26
+ /***
27
+ * Check invalid nip format
28
+ * @param nip {string} - nip string
29
+ * @return return true when incorrect
30
+ */
31
+ static isInvalid(nip: string): boolean {
32
+ return !NipService.isValid(nip);
33
+ }
35
34
  }
@@ -1,6 +1,7 @@
1
- import { ObjectService } from './object.service';
2
1
  import { isNull } from 'util';
3
2
 
3
+ import { ObjectService } from './object.service';
4
+
4
5
  describe('shared-utils: ObjectService', () => {
5
6
  describe('createByType()', () => {
6
7
  it('should return same object when exist same type', () => {
@@ -14,7 +14,7 @@ export class SpecificationService {
14
14
  static valid<T>(
15
15
  value: T,
16
16
  spec: { criteria: any },
17
- custom?: ISpecificationCustom
17
+ custom?: ISpecificationCustom,
18
18
  ): boolean {
19
19
  const keys = Object.keys(spec.criteria);
20
20
 
@@ -27,7 +27,7 @@ export class SpecificationService {
27
27
  if (
28
28
  !SpecificationService.check(
29
29
  custom?.$root[key.replace(SPECIFICATION_ROOT_KEY, '')],
30
- spec.criteria[key]
30
+ spec.criteria[key],
31
31
  )
32
32
  )
33
33
  return false;
@@ -49,7 +49,7 @@ export class SpecificationService {
49
49
  static invalid<T>(
50
50
  value: T,
51
51
  spec: { criteria: any },
52
- custom?: ISpecificationCustom
52
+ custom?: ISpecificationCustom,
53
53
  ): boolean {
54
54
  return !SpecificationService.valid(value, spec, custom);
55
55
  }