intelicoreact 0.1.34 → 0.1.37

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,14 +15,15 @@ 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).replace(/\D/g, '');
18
+ return (!!value ? value.toString() : '').replace(/\D/g, '');
19
19
  };
20
20
 
21
21
  exports.formatOnlyNumbers = formatOnlyNumbers;
22
22
 
23
- var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(value) {
23
+ var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(inputValue) {
24
24
  var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
25
- //содержит ли value точку
25
+ var value = !!inputValue ? inputValue.toString() : ''; //содержит ли value точку
26
+
26
27
  var isFraction = value.includes('.'); //взять строку до точки
27
28
 
28
29
  var valueBeforeDot = isFraction ? value.slice(0, value.indexOf('.')) : value; //расстановка запятых после каждой 3й цифры с конца
@@ -35,7 +36,8 @@ var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(value) {
35
36
 
36
37
  exports.formatToAddBitDepthPoints = formatToAddBitDepthPoints;
37
38
 
38
- var formatToTwoDigitAfterDot = function formatToTwoDigitAfterDot(value) {
39
+ var formatToTwoDigitAfterDot = function formatToTwoDigitAfterDot(inputValue) {
40
+ var value = !!inputValue ? inputValue.toString() : '';
39
41
  var arr = value.split('.');
40
42
  var intPart = arr.shift();
41
43
  var decimalPart = arr.join('').replace(/\s/g, '').slice(0, 2);
@@ -44,8 +46,9 @@ var formatToTwoDigitAfterDot = function formatToTwoDigitAfterDot(value) {
44
46
 
45
47
  exports.formatToTwoDigitAfterDot = formatToTwoDigitAfterDot;
46
48
 
47
- var formatToLetters = function formatToLetters(value) {
49
+ var formatToLetters = function formatToLetters(inputValue) {
48
50
  var soft = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
51
+ var value = !!inputValue ? inputValue.toString() : '';
49
52
 
50
53
  if (soft) {
51
54
  return value.toString().replace(/[^a-z-]/gi, '');
@@ -58,26 +61,28 @@ var formatToLetters = function formatToLetters(value) {
58
61
  exports.formatToLetters = formatToLetters;
59
62
 
60
63
  var formatToOnlyASCIICodeText = function formatToOnlyASCIICodeText(text) {
61
- return text === null || text === void 0 ? void 0 : text.replace(/[^\x00-\x7F]+/g, '');
64
+ return (!!text ? text.toString() : '').replace(/[^\x00-\x7F]+/g, '');
62
65
  };
63
66
 
64
67
  exports.formatToOnlyASCIICodeText = formatToOnlyASCIICodeText;
65
68
 
66
69
  var formatToRemoveComa = function formatToRemoveComa(value) {
67
- return value.toString().replace(/\,/g, '');
70
+ return (!!value ? value.toString() : '').toString().replace(/\,/g, '');
68
71
  };
69
72
 
70
73
  exports.formatToRemoveComa = formatToRemoveComa;
71
74
 
72
- var formatToCutOffDotAtTheEnd = function formatToCutOffDotAtTheEnd(value) {
75
+ var formatToCutOffDotAtTheEnd = function formatToCutOffDotAtTheEnd(inputValue) {
76
+ var value = !!inputValue ? inputValue.toString() : '';
73
77
  return value.toString().slice(-1) === '.' ? value.slice(0, -1) : value;
74
78
  }; // filter
75
79
 
76
80
 
77
81
  exports.formatToCutOffDotAtTheEnd = formatToCutOffDotAtTheEnd;
78
82
 
79
- var filterFloat = function filterFloat(value) {
83
+ var filterFloat = function filterFloat(inputValue) {
80
84
  var decimalPlaces = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
85
+ var value = !!inputValue ? inputValue.toString() : '';
81
86
 
82
87
  var replaser = function replaser(input) {
83
88
  return ('' + input).replace(/[^\.\d]/g, '');
@@ -94,14 +99,15 @@ var filterFloat = function filterFloat(value) {
94
99
 
95
100
  exports.filterFloat = filterFloat;
96
101
 
97
- var filterToLimitLength = function filterToLimitLength(value, limit) {
102
+ var filterToLimitLength = function filterToLimitLength(inputValue, limit) {
103
+ var value = !!inputValue ? inputValue.toString() : '';
98
104
  return limit && typeof limit === 'number' && !Number.isNaN(limit) && (value === null || value === void 0 ? void 0 : value.length) > limit ? value.substr(0, limit) : value;
99
105
  };
100
106
 
101
107
  exports.filterToLimitLength = filterToLimitLength;
102
108
 
103
109
  var filterPhone = function filterPhone(value) {
104
- return limitLength(filterNumbers(value), _index.MAX_PHONE_LENGTH);
110
+ return limitLength(filterNumbers(!!value ? value.toString() : ''), _index.MAX_PHONE_LENGTH);
105
111
  };
106
112
 
107
113
  exports.filterPhone = filterPhone;
@@ -113,7 +119,7 @@ var filterNumeric = function filterNumeric(value, settings) {
113
119
  decimalPlaces = _ref.decimalPlaces;
114
120
 
115
121
  var executor = type === 'float' ? filterFloat : formatOnlyNumbers;
116
- return executor(value, decimalPlaces);
122
+ return executor(!!value ? value.toString() : '', decimalPlaces);
117
123
  };
118
124
 
119
125
  exports.filterNumeric = filterNumeric;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "0.1.34",
3
+ "version": "0.1.37",
4
4
  "description": "fixes",
5
5
  "main": "dist/index.js",
6
6
  "files": ["dist/*", "node_modules/anme/*", "node_modules/moment/*", "node_modules/moment-timezone/*"],