intelicoreact 0.1.59 → 0.1.60

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.
@@ -15,18 +15,18 @@ var _index = require("../Constants/index.constants");
15
15
  // The first word "filter" in the function name means a logic in which the function works as a changer for sequential input
16
16
  // *** format ***
17
17
  var formatOnlyNumbers = function formatOnlyNumbers(value) {
18
- return (!!value ? value.toString() : '').replace(/\D/g, '');
18
+ return (value ? value.toString() : '').replace(/\D/g, '');
19
19
  };
20
20
 
21
21
  exports.formatOnlyNumbers = formatOnlyNumbers;
22
22
 
23
23
  var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(inputValue) {
24
24
  var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
25
- var value = !!inputValue ? inputValue.toString() : ''; //содержит ли value точку
25
+ var value = inputValue ? inputValue.toString() : ''; // содержит ли value точку
26
26
 
27
- var isFraction = value.includes('.'); //взять строку до точки
27
+ var isFraction = value.includes('.'); // взять строку до точки
28
28
 
29
- var valueBeforeDot = isFraction ? value.slice(0, value.indexOf('.')) : value; //расстановка запятых после каждой 3й цифры с конца
29
+ var valueBeforeDot = isFraction ? value.slice(0, value.indexOf('.')) : value; // расстановка запятых после каждой 3й цифры с конца
30
30
 
31
31
  var intPart = valueBeforeDot.split('').reverse().reduce(function (acc, item, idx) {
32
32
  return idx % step === 0 && idx !== 0 ? [].concat((0, _toConsumableArray2.default)(acc), [',', item]) : [].concat((0, _toConsumableArray2.default)(acc), [item]);
@@ -37,46 +37,45 @@ var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(inputValue) {
37
37
  exports.formatToAddBitDepthPoints = formatToAddBitDepthPoints;
38
38
 
39
39
  var formatToTwoDigitAfterDot = function formatToTwoDigitAfterDot(inputValue) {
40
- var value = !!inputValue ? inputValue.toString() : '';
40
+ var value = inputValue ? inputValue.toString() : '';
41
41
  var arr = value.split('.');
42
42
  var intPart = arr.shift();
43
43
  var decimalPart = arr.join('').replace(/\s/g, '').slice(0, 2);
44
- return intPart + (decimalPart.length ? '.' + decimalPart : '');
44
+ return intPart + (decimalPart.length ? ".".concat(decimalPart) : '');
45
45
  };
46
46
 
47
47
  exports.formatToTwoDigitAfterDot = formatToTwoDigitAfterDot;
48
48
 
49
49
  var formatToLetters = function formatToLetters(inputValue) {
50
50
  var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
51
- var value = !!inputValue ? inputValue.toString() : '';
51
+ var value = inputValue ? inputValue.toString() : '';
52
52
 
53
53
  if (soft) {
54
54
  return value.toString().replace(/[^a-z-]/gi, '');
55
- } else {
56
- return value.toString().replace(/[^a-z]/gi, '');
57
55
  }
56
+
57
+ return value.toString().replace(/[^a-z]/gi, '');
58
58
  }; // eslint-disable-next-line no-control-regex
59
59
 
60
60
 
61
61
  exports.formatToLetters = formatToLetters;
62
62
 
63
63
  var formatToOnlyASCIICodeText = function formatToOnlyASCIICodeText(text) {
64
- return (!!text ? text.toString() : '').replace(/[^\x00-\x7F]+/g, '');
64
+ return (text ? text.toString() : '').replace(/[^\x00-\x7F]+/g, '');
65
65
  };
66
66
 
67
67
  exports.formatToOnlyASCIICodeText = formatToOnlyASCIICodeText;
68
68
 
69
69
  var formatToRemoveComa = function formatToRemoveComa(value) {
70
- return (!!value ? value.toString() : '').toString().replace(/\,/g, '');
70
+ return (value ? value.toString() : '').toString().replace(/\,/g, '');
71
71
  };
72
72
 
73
73
  exports.formatToRemoveComa = formatToRemoveComa;
74
74
 
75
75
  var formatToCutOffDotAtTheEnd = function formatToCutOffDotAtTheEnd(inputValue) {
76
- var value = !!inputValue ? inputValue.toString() : '';
76
+ var value = inputValue ? inputValue.toString() : '';
77
77
  return value.toString().slice(-1) === '.' ? value.slice(0, -1) : value;
78
- }; // eslint-disable-next-line default-param-last
79
-
78
+ };
80
79
 
81
80
  exports.formatToCutOffDotAtTheEnd = formatToCutOffDotAtTheEnd;
82
81
 
@@ -93,12 +92,13 @@ var formatNumberValueToMask = function formatNumberValueToMask() {
93
92
  _ref$isReturnAdvanced = _ref.isReturnAdvanced,
94
93
  isReturnAdvanced = _ref$isReturnAdvanced === void 0 ? false : _ref$isReturnAdvanced;
95
94
 
96
- var processing = mask.split('').reduce(function (acc, item) {
95
+ var processing = mask === null || mask === void 0 ? void 0 : mask.split('').reduce(function (acc, item) {
96
+ // eslint-disable-next-line no-plusplus
97
97
  if (acc.value.length) ++acc.cursorPosition;
98
98
  acc.newValue.push(item === valueSymbol && acc.value.length ? acc.value.shift() : item);
99
99
  return acc;
100
100
  }, {
101
- value: inputValue.split('').filter(function (sym) {
101
+ value: inputValue === null || inputValue === void 0 ? void 0 : inputValue.split('').filter(function (sym) {
102
102
  return /[0-9]/g.test(sym);
103
103
  }),
104
104
  newValue: [],
@@ -115,17 +115,17 @@ exports.formatNumberValueToMask = formatNumberValueToMask;
115
115
 
116
116
  var filterFloat = function filterFloat(inputValue) {
117
117
  var decimalPlaces = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
118
- var value = !!inputValue ? inputValue.toString() : '';
118
+ var value = inputValue ? inputValue.toString() : '';
119
119
 
120
120
  var replaser = function replaser(input) {
121
- return ('' + input).replace(/[^\.\d]/g, '');
121
+ return "".concat(input).replace(/[^\.\d]/g, '');
122
122
  };
123
123
 
124
124
  if (value.length === 1 && (value[0] === '.' || value[0] === ',')) return '0.';
125
- var output = ('' + value).replace(/,/g, '.');
125
+ var output = "".concat(value).replace(/,/g, '.');
126
126
  if (value.length > 1 && value[0] === '0' && value[1] !== '.' && value[0] !== ',') output = value.slice(1);
127
- var previousValue = '' + output.slice(0, -1);
128
- var lastSym = '' + output.slice(-1);
127
+ var previousValue = "".concat(output.slice(0, -1));
128
+ var lastSym = "".concat(output.slice(-1));
129
129
  if (decimalPlaces && typeof decimalPlaces === 'number' && previousValue.includes('.') && previousValue.indexOf('.') + 1 + decimalPlaces === previousValue.length) return replaser(previousValue);
130
130
  return replaser(lastSym === '.' && previousValue.includes('.') ? previousValue : output);
131
131
  };
@@ -133,14 +133,14 @@ var filterFloat = function filterFloat(inputValue) {
133
133
  exports.filterFloat = filterFloat;
134
134
 
135
135
  var filterToLimitLength = function filterToLimitLength(inputValue, limit) {
136
- var value = !!inputValue ? inputValue.toString() : '';
136
+ var value = inputValue ? inputValue.toString() : '';
137
137
  return limit && typeof limit === 'number' && !Number.isNaN(limit) && (value === null || value === void 0 ? void 0 : value.length) > limit ? value.substr(0, limit) : value;
138
138
  };
139
139
 
140
140
  exports.filterToLimitLength = filterToLimitLength;
141
141
 
142
142
  var filterPhone = function filterPhone(value) {
143
- return limitLength(filterNumbers(!!value ? value.toString() : ''), _index.MAX_PHONE_LENGTH);
143
+ return limitLength(filterNumbers(value ? value.toString() : ''), _index.MAX_PHONE_LENGTH);
144
144
  };
145
145
 
146
146
  exports.filterPhone = filterPhone;
@@ -152,7 +152,7 @@ var filterNumeric = function filterNumeric(value, settings) {
152
152
  decimalPlaces = _ref2.decimalPlaces;
153
153
 
154
154
  var executor = type === 'float' ? filterFloat : formatOnlyNumbers;
155
- return executor(!!value ? value.toString() : '', decimalPlaces);
155
+ return executor(value ? value.toString() : '', decimalPlaces);
156
156
  };
157
157
 
158
158
  exports.filterNumeric = filterNumeric;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "description": "fix UserBox crush",
5
5
  "main": "dist/index.js",
6
6
  "files": ["dist/*", "node_modules/anme/*", "node_modules/moment/*", "node_modules/moment-timezone/*"],