summaryrefslogtreecommitdiff
path: root/node_modules/swup/src/modules/resolveUrl.ts
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:10:59 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:41:44 +0800
commitfc87c009806dcc98867f6b58efe29b042aa01dee (patch)
tree8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/swup/src/modules/resolveUrl.ts
parent3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff)
node: updatemain
Diffstat (limited to 'node_modules/swup/src/modules/resolveUrl.ts')
-rwxr-xr-xnode_modules/swup/src/modules/resolveUrl.ts33
1 files changed, 0 insertions, 33 deletions
diff --git a/node_modules/swup/src/modules/resolveUrl.ts b/node_modules/swup/src/modules/resolveUrl.ts
deleted file mode 100755
index a687d6fe..00000000
--- a/node_modules/swup/src/modules/resolveUrl.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import type Swup from '../Swup.js';
-
-/**
- * Utility function to validate and run the global option 'resolveUrl'
- * @param {string} url
- * @returns {string} the resolved url
- */
-export function resolveUrl(this: Swup, url: string): string {
- if (typeof this.options.resolveUrl !== 'function') {
- console.warn(`[swup] options.resolveUrl expects a callback function.`);
- return url;
- }
- const result = this.options.resolveUrl(url);
- if (!result || typeof result !== 'string') {
- console.warn(`[swup] options.resolveUrl needs to return a url`);
- return url;
- }
- if (result.startsWith('//') || result.startsWith('http')) {
- console.warn(`[swup] options.resolveUrl needs to return a relative url`);
- return url;
- }
- return result;
-}
-
-/**
- * Compares the resolved version of two paths and returns true if they are the same
- * @param {string} url1
- * @param {string} url2
- * @returns {boolean}
- */
-export function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {
- return this.resolveUrl(url1) === this.resolveUrl(url2);
-}