Skip to content

Commit 171eecb

Browse files
committed
Use isUrl from registry
1 parent e752550 commit 171eecb

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

src/utils/sdk.mts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'
33
import isInteractive from '@socketregistry/is-interactive/index.cjs'
44
import { password } from '@socketsecurity/registry/lib/prompts'
55
import { isNonEmptyString } from '@socketsecurity/registry/lib/strings'
6+
import { isUrl } from '@socketsecurity/registry/lib/url'
67
import { SocketSdk, createUserAgentFromPkgJson } from '@socketsecurity/sdk'
78

89
import { getConfigValueOrUndef } from './config.mts'
@@ -30,17 +31,6 @@ export function getDefaultProxyUrl(): string | undefined {
3031
return isUrl(apiProxy) ? apiProxy : undefined
3132
}
3233

33-
function isUrl(value: any): value is string {
34-
if (isNonEmptyString(value)) {
35-
try {
36-
// eslint-disable-next-line no-new
37-
new URL(value)
38-
return true
39-
} catch {}
40-
}
41-
return false
42-
}
43-
4434
// This Socket API token should be stored globally for the duration of the CLI execution.
4535
let _defaultToken: string | undefined
4636
export function getDefaultApiToken(): string | undefined {

0 commit comments

Comments
 (0)