PHP 8.2.30
Preview: escapeHtml.js Size: 1.69 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@hapi/hoek/lib/escapeHtml.js

'use strict';

const internals = {};


module.exports = function (input) {

    if (!input) {
        return '';
    }

    let escaped = '';

    for (let i = 0; i < input.length; ++i) {

        const charCode = input.charCodeAt(i);

        if (internals.isSafe(charCode)) {
            escaped += input[i];
        }
        else {
            escaped += internals.escapeHtmlChar(charCode);
        }
    }

    return escaped;
};


internals.escapeHtmlChar = function (charCode) {

    const namedEscape = internals.namedHtml.get(charCode);
    if (namedEscape) {
        return namedEscape;
    }

    if (charCode >= 256) {
        return '&#' + charCode + ';';
    }

    const hexValue = charCode.toString(16).padStart(2, '0');
    return `&#x${hexValue};`;
};


internals.isSafe = function (charCode) {

    return internals.safeCharCodes.has(charCode);
};


internals.namedHtml = new Map([
    [38, '&amp;'],
    [60, '&lt;'],
    [62, '&gt;'],
    [34, '&quot;'],
    [160, '&nbsp;'],
    [162, '&cent;'],
    [163, '&pound;'],
    [164, '&curren;'],
    [169, '&copy;'],
    [174, '&reg;']
]);


internals.safeCharCodes = (function () {

    const safe = new Set();

    for (let i = 32; i < 123; ++i) {

        if ((i >= 97) ||                    // a-z
            (i >= 65 && i <= 90) ||         // A-Z
            (i >= 48 && i <= 57) ||         // 0-9
            i === 32 ||                     // space
            i === 46 ||                     // .
            i === 44 ||                     // ,
            i === 45 ||                     // -
            i === 58 ||                     // :
            i === 95) {                     // _

            safe.add(i);
        }
    }

    return safe;
}());

Directory Contents

Dirs: 0 × Files: 26

Name Size Perms Modified Actions
2.61 KB lrw-r--r-- 2026-02-21 00:53:22
Edit Download
307 B lrw-r--r-- 2026-02-21 00:53:22
Edit Download
401 B lrw-r--r-- 2026-02-21 00:53:24
Edit Download
144 B lrw-r--r-- 2026-02-21 00:53:24
Edit Download
4.07 KB lrw-r--r-- 2026-02-21 00:53:28
Edit Download
6.39 KB lrw-r--r-- 2026-02-21 00:53:28
Edit Download
7.48 KB lrw-r--r-- 2026-02-21 00:53:30
Edit Download
595 B lrw-r--r-- 2026-02-21 00:53:32
Edit Download
474 B lrw-r--r-- 2026-02-21 00:53:34
Edit Download
1.69 KB lrw-r--r-- 2026-02-21 00:53:34
Edit Download
437 B lrw-r--r-- 2026-02-21 00:53:34
Edit Download
198 B lrw-r--r-- 2026-02-21 00:53:36
Edit Download
349 B lrw-r--r-- 2026-02-21 00:53:36
Edit Download
73 B lrw-r--r-- 2026-02-21 00:53:36
Edit Download
12.42 KB lrw-r--r-- 2026-02-21 00:53:50
Edit Download
968 B lrw-r--r-- 2026-02-21 00:53:38
Edit Download
780 B lrw-r--r-- 2026-02-21 00:53:38
Edit Download
141 B lrw-r--r-- 2026-02-21 00:53:38
Edit Download
2.36 KB lrw-r--r-- 2026-02-21 00:53:40
Edit Download
401 B lrw-r--r-- 2026-02-21 00:53:40
Edit Download
1.84 KB lrw-r--r-- 2026-02-21 00:53:42
Edit Download
320 B lrw-r--r-- 2026-02-21 00:53:42
Edit Download
224 B lrw-r--r-- 2026-02-21 00:53:44
Edit Download
1.23 KB lrw-r--r-- 2026-02-21 00:53:44
Edit Download
205 B lrw-r--r-- 2026-02-21 00:53:46
Edit Download
901 B lrw-r--r-- 2026-02-21 00:53:46
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).