Abstracted capitalize to the utility script

This commit is contained in:
Angelos Chalaris
2018-02-04 20:09:28 +02:00
parent b710847d58
commit c37df3ee82
3 changed files with 14 additions and 14 deletions

View File

@ -48,6 +48,7 @@ const readTags = () => {
}
return tagDbData;
}
// Optimizes nodes in an HTML document
const optimizeNodes = (data, regexp, replacer) => {
let count = 0;
let output = data;
@ -60,4 +61,7 @@ const optimizeNodes = (data, regexp, replacer) => {
} while (count > 0);
return output;
}
module.exports = {readSnippets, readTags, optimizeNodes};
// Capitalizes the first letter of a string
const capitalize = (str, lowerRest = false) =>
str.slice(0, 1).toUpperCase() + (lowerRest ? str.slice(1).toLowerCase() : str.slice(1));
module.exports = {readSnippets, readTags, optimizeNodes, capitalize};