diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index b81ec47a82..1c9d27e44f 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -171,10 +171,6 @@ function hasToJSON(value: unknown): value is ObjectWithToJSON { return typeof value === 'object' && value !== null && value.hasOwnProperty('toJSON') } -export function startsWith(candidate: string, search: string) { - return candidate.indexOf(search) === 0 -} - export function includes(candidate: unknown[], search: unknown) { return candidate.indexOf(search) !== -1 } diff --git a/packages/rum/src/resourceUtils.ts b/packages/rum/src/resourceUtils.ts index edd167deff..6c9c54c7b3 100644 --- a/packages/rum/src/resourceUtils.ts +++ b/packages/rum/src/resourceUtils.ts @@ -1,4 +1,4 @@ -import { addMonitoringMessage, Configuration, includes, msToNs, ResourceKind, startsWith } from '@datadog/browser-core' +import { addMonitoringMessage, Configuration, includes, msToNs, ResourceKind } from '@datadog/browser-core' import { PerformanceResourceDetails } from './rum' @@ -98,5 +98,5 @@ function isBrowserAgentRequest(url: string, configuration: Configuration) { } function haveSameOrigin(url1: string, url2: string) { - return startsWith(url2, new URL(url1).origin) + return new URL(url1).origin === new URL(url2).origin }