diff --git a/src/js/utils/strings.js b/src/js/utils/strings.js index 3e78a8e6..acf51780 100644 --- a/src/js/utils/strings.js +++ b/src/js/utils/strings.js @@ -11,9 +11,7 @@ export function generateId(prefix) { // Format string export function format(input, ...args) { - if (is.empty(input)) { - return input; - } + if (is.empty(input)) return input; return input.toString().replace(/{(\d+)}/g, (match, i) => args[i].toString()); } @@ -27,7 +25,7 @@ export function getPercentage(current, max) { return ((current / max) * 100).toFixed(2); } -// Replace all occurances of a string in a string +// Replace all occurrences of a string in a string export const replaceAll = (input = '', find = '', replace = '') => input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString());