intelicoreact 0.0.81 → 0.0.85

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.
@@ -4,38 +4,29 @@ export const formatInput = {
4
4
  value = value.toString();
5
5
  const isFraction = value.includes('.');
6
6
 
7
- const valueBeforeDot = isFraction
8
- ? value.slice(0, value.indexOf('.'))
9
- : value;
7
+ const valueBeforeDot = isFraction ? value.slice(0, value.indexOf('.')) : value;
10
8
 
11
9
  const intPart = valueBeforeDot
12
10
  .split('')
13
11
  .reverse()
14
- .reduce(
15
- (acc, item, idx) =>
16
- idx % 3 === 0 && idx !== 0 ? [...acc, ',', item] : [...acc, item],
17
- []
18
- )
12
+ .reduce((acc, item, idx) => (idx % 3 === 0 && idx !== 0 ? [...acc, ',', item] : [...acc, item]), [])
19
13
  .reverse()
20
14
  .join('');
21
15
 
22
16
  return isFraction ? intPart + value.slice(value.indexOf('.')) : intPart;
23
17
  },
24
18
  removeComma: (value) => {
25
- return parseFloat(value.toString().replace(/\,/g, ''));
26
- }
19
+ return parseInt(value.toString().replace(/\,/g, ''));
20
+ },
27
21
  },
28
22
  onlyNumbers: (value, isDot = false) => {
29
- const val =
30
- value.slice(0, 1) !== '0' && value.slice(0, 1) !== '.'
31
- ? value
32
- : value.slice(1);
23
+ const val = value.slice(0, 1) !== '0' && value.slice(0, 1) !== '.' ? value : value.slice(1);
33
24
  if (isDot) return twoDigitAfterDot(val.replace(/[^0-9.]/g, ''));
34
25
  else return +val.toString().replace(/\D/g, '');
35
26
  },
36
27
  onlyString: (value) => {
37
28
  return value.toString().replace(/[^a-z]/gi, '');
38
- }
29
+ },
39
30
  };
40
31
 
41
32
  //обрезает числа после точки до 2х