File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 55import { globalScope } from '../constants/runtime'
66import { gosNREUMOriginals } from '../window/nreum'
77
8- export function extractUrl ( target ) {
9- if ( typeof target === 'string' ) {
10- return target
11- } else if ( typeof target === 'object' && target instanceof gosNREUMOriginals ( ) . o . REQ ) {
12- return target . url
13- } else if ( globalScope ?. URL && typeof target === 'object' && target instanceof URL ) {
14- return target . href
15- }
16- return undefined
8+ /**
9+ * Extracts a URL from various target types.
10+ * @param { string|Request|URL } target - The target to extract the URL from. It can be a string, a Fetch Request object, or a URL object.
11+ * @returns { string|undefined } The extracted URL as a string, or undefined if the target type is not supported.
12+ */
13+ export function extractUrl ( target ) {
14+ if ( typeof target === 'string' ) return target
15+ else if ( target instanceof gosNREUMOriginals ( ) . o . REQ ) return target . url
16+ else if ( globalScope ?. URL && target instanceof URL ) return target . href
1717}
You can’t perform that action at this time.
0 commit comments