Z User
phase7: MCP stdio smoke test (handshake + tools/list + get_roots 6:74) — 4/4 tests PASS
54a6341 Download node_modules/encodeurl/index.js from bravesigma/quran-md-plugin: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/encodeurl/index.js
- Command line
-
hf download hf://datasets/bravesigma/quran-md-plugin/node_modules/encodeurl/index.js
-
curl -L -o index.js https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/encodeurl/index.js
1.64 kB
| /*! | |
| * encodeurl | |
| * Copyright(c) 2016 Douglas Christopher Wilson | |
| * MIT Licensed | |
| */ | |
| /** | |
| * Module exports. | |
| * @public | |
| */ | |
| module.exports = encodeUrl | |
| /** | |
| * RegExp to match non-URL code points, *after* encoding (i.e. not including "%") | |
| * and including invalid escape sequences. | |
| * Group up to 1024 character and percent runs per replacement to reduce calls | |
| * to encodeURI while bounding RegExp stack use. Character runs stay intact so | |
| * surrogate pairs are never split between replacements. | |
| * @private | |
| */ | |
| var ENCODE_CHARS_REGEXP = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]+|%+(?![0-9A-Fa-f]{2})){1,1024}/g | |
| /** | |
| * RegExp to match surrogate pairs and unpaired surrogates. | |
| * @private | |
| */ | |
| var SURROGATE_REGEXP = /([\uD800-\uDBFF][\uDC00-\uDFFF])|[\uD800-\uDFFF]/g | |
| /** | |
| * Encode a URL to a percent-encoded form, excluding already-encoded sequences. | |
| * | |
| * This function will take an already-encoded URL and encode all the non-URL | |
| * code points. This function will not encode the "%" character unless it is | |
| * not part of a valid sequence (`%20` will be left as-is, but `%foo` will | |
| * be encoded as `%25foo`). | |
| * | |
| * This encode is meant to be "safe" and does not throw errors. It will try as | |
| * hard as it can to properly encode the given URL, including replacing any raw, | |
| * unpaired surrogate pairs with the Unicode replacement character prior to | |
| * encoding. | |
| * | |
| * @param {string} url | |
| * @return {string} | |
| * @public | |
| */ | |
| function encodeUrl (url) { | |
| return String(url) | |
| .replace(SURROGATE_REGEXP, function (_, pair) { | |
| return pair || '\uFFFD' | |
| }) | |
| .replace(ENCODE_CHARS_REGEXP, encodeURI) | |
| } | |