| 1 |
// helper Functions: function 'textInsideForEdit' is for setting the innertext depending on whether separator should be shown and which separator should be shown in the number-counter block |
| 2 |
export const textInsideForEdit = (value, isShowSeparator, separator) => |
| 3 |
isShowSeparator |
| 4 |
? value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator) |
| 5 |
: value.toString(); |
| 6 |
|
| 7 |
// generateRandomNumber function is for generating a random number |
| 8 |
export const generateRandomNumber = () => |
| 9 |
Math.floor(Math.random() * 1000000000); |
| 10 |
|
| 11 |
// hardMinifyCssStrings is for minifying the css which is in the style tag as a string for view.js |
| 12 |
export const hardMinifyCssStrings = (cssString) => { |
| 13 |
return ( |
| 14 |
cssString |
| 15 |
.replace(/\s+/g, " ") |
| 16 |
.replace(/(?<=\:).+(?=\;)/g, function (match) { |
| 17 |
return match.trim().replace(/\s+/g, "__s_p_a_c_e__"); |
| 18 |
}) |
| 19 |
// .replace(/\s+(?!(?:[\w\d\.\-\#]+\{))/g, "") |
| 20 |
.replace(/\s+(?![\w\d\.\-\#]+\{)/g, "") |
| 21 |
.replace(/\s+/g, " ") |
| 22 |
.replace(/__s_p_a_c_e__/g, " ") |
| 23 |
); |
| 24 |
}; |
| 25 |
|
| 26 |
// softMinifyCssStrings is for minifying the css which is in the style tag as a string for view.js |
| 27 |
export const softMinifyCssStrings = (cssString = " ") => cssString .replace(/\s+/g, " ") .replace(/\.eb\-[\w\-\s\.\,\:\>\=\"\'\(\)\d\+\[\]\#\>]+\{[\s]+\}/g, ""); |
| 28 |
|
| 29 |
// check if css string is empty or not. |
| 30 |
export const isCssExists = (cssString) => |
| 31 |
/.+(?=\:(?!hover)(?!focus))/.test(cssString); |
| 32 |
|