From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- .../tmp/src/foundation/metrics/cookies.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 node_modules/@jet-app/app-store/tmp/src/foundation/metrics/cookies.js (limited to 'node_modules/@jet-app/app-store/tmp/src/foundation/metrics/cookies.js') diff --git a/node_modules/@jet-app/app-store/tmp/src/foundation/metrics/cookies.js b/node_modules/@jet-app/app-store/tmp/src/foundation/metrics/cookies.js new file mode 100644 index 0000000..5005b72 --- /dev/null +++ b/node_modules/@jet-app/app-store/tmp/src/foundation/metrics/cookies.js @@ -0,0 +1,27 @@ +import { isNothing } from "@jet/environment/types/optional"; +/** + * Iterate the cookies contained in a string. + * + * @param cookie A string containing zero or more cookies. + */ +export function* cookiesOf(cookie) { + if (isNothing(cookie)) { + return; + } + const rawEntries = cookie.split(";"); + for (const rawEntry of rawEntries) { + const keyEndIndex = rawEntry.indexOf("="); + if (keyEndIndex === -1) { + // If there's no splitter, treat the whole raw + // entry as the key and provide an empty value. + const key = decodeURIComponent(rawEntry).trim(); + yield { key, value: "" }; + } + else { + const key = decodeURIComponent(rawEntry.substring(0, keyEndIndex)).trim(); + const value = decodeURIComponent(rawEntry.substring(keyEndIndex + 1)).trim(); + yield { key, value }; + } + } +} +//# sourceMappingURL=cookies.js.map \ No newline at end of file -- cgit v1.2.3