A JavaScript class, which finalises the HTML of each page of my NodeJS (Express) website
Ways of improving/optimizations:

What fixApostrophes and fixDashes functions actually try to do is replacing a specific punctuation chars with respective HTML entities.
Instead of those numerous horrifying while loops - a more optimized, concise and extendable approach would be to:


compose a predefined replacement map (where keys are search patterns and values - respective entities values):

const replaceMap = {"``": "&amp;ldquo;", "''": "&amp;rdquo;", "`": "&amp;lsquo;",
                    "'": "&amp;rsquo;", "---": "&amp;mdash;", "--": "&amp;ndash;"};

perform all the replacements at once
with String.replace function based on combined regex pattern:

input = input.replace(new RegExp(Object.keys(replaceMap).join('|'), 'g'), function(m){
    return replaceMap[m] || m;
});  


where Object.keys(replaceMap).join('|') is used to compose regex alternation group from replaceMap keys like ''|'|---|--
the former 2 functions can be conceptually combined into a single function called, say punctToEntities ("punctuations to entities")


Eventually, the Finaliser class would look as:

const replaceMap = {"``": "&amp;ldquo;", "''": "&amp;rdquo;", "`": "&amp;lsquo;",
                    "'": "&amp;rsquo;", "---": "&amp;mdash;", "--": "&amp;ndash;"};

class Finaliser
{
    constructor()
    {

    }

    static punctToEntities(input) {
    /** Converts punctuation chars to respective HTML entities **/
        input = input.replace(new RegExp(Object.keys(replaceMap).join('|'), 'g'), function(m){
            return replaceMap[m] || m;
        });  

        return input;
    }

    // Render, and deliver the page to the browser.
    protoRender(req, res, view, properties) {
        var date = new Date();

        properties.footstamp = date.toISOString();
        res.render(view, properties, function(err, html){
            if (html === undefined) {
                res.render(view, properties);
            } else {
                html = Finaliser.punctToEntities(html);
                res.send(html);
            }
        });
    }
}