omniJS script url encoding – JS encodeURIComponent not enough?

I have been using the standard JavaScript encodeURIComponent to create omniJS URLs, apparently without problem, so I was interested to notice, at:

https://omni-automation.com/script-links.html

A script roughly along ES6-equivalent lines of:

// encodeForOmniJS :: String -> String -> String
const encodeForOmniJS = (OmniAppName, scriptCode) =>
    OmniAppName.toLowerCase() + ":///omnijs-run?script=" +
    "'()!~.".split('')
    .reduce((a, x) =>
        a.replace(
            RegExp('\\' + x, 'g'), '%' + (x.charCodeAt(0)
                .toString(16)
                .toUpperCase())
        ),
        encodeURIComponent(scriptCode));

Which adds a second pass after encodeURIComponent – also encoding the six extra characters: '()!~.

Should I be doing this too ? (These are characters which don’t usually need encoding in a URL)

Or, getting the Babel JS repl at https://babeljs.io/repl to automatically convert from the ES6-compliant JS used by Sierra, to the mainly ES5-level JS of earlier macOS versions:

// encodeForOmniJS :: String -> String -> String
function encodeForOmniJS(OmniAppName, scriptCode) {
    return OmniAppName.toLowerCase() + ":///omnijs-run?script=" +
        "'()!~.".split('')
        .reduce(function (a, x) {
            return a.replace(RegExp('\\' + x, 'g'), '%' + x.charCodeAt(0)
                .toString(16)
                .toUpperCase());
        }, encodeURIComponent(scriptCode));
}