Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Dec 17, 2024
1 parent b38d605 commit 6185301
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ export const cleanText = (str: string): string => {
.replace(/\u00A0/g, ' ') // Replace non-breaking spaces with a regular space
.trim() // Trim leading and trailing spaces
}

// Check if a subset object is a partial match of another object
export const isObjectMatch = <Obj extends Record<string, any>>(
partialObj: Partial<Obj>,
mainObj: Obj
): boolean => {
return Object.keys(partialObj).every(
(key) => partialObj[key as keyof Obj] === mainObj[key as keyof Obj]
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Emitter } from '@segment/analytics-generic-utils'
import { exists } from '../../../lib/exists'
import { debounceWithKey } from '../../../lib/debounce'
import { logger } from '../../../lib/logger'
import { isObjectMatch } from './helpers'

const DEFAULT_OBSERVED_ATTRIBUTES = [
'aria-pressed',
Expand Down Expand Up @@ -32,15 +33,6 @@ const DEFAULT_OBSERVED_ROLES = [
'treeitem',
]

// Check if a subset object is a partial match of another object
const isObjectMatch = <Obj extends Record<string, any>>(
partialObj: Partial<Obj>,
mainObj: Obj
): boolean => {
return Object.keys(partialObj).every(
(key) => partialObj[key as keyof Obj] === mainObj[key as keyof Obj]
)
}
type AttributeMutations = { [attributeName: string]: string | null }
export type AttributeChangedEvent = {
element: HTMLElement
Expand Down

0 comments on commit 6185301

Please sign in to comment.