File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
packages/signals/signals/src/core/signal-generators/dom-gen Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,13 @@ export const cleanText = (str: string): string => {
55 . replace ( / \u00A0 / g, ' ' ) // Replace non-breaking spaces with a regular space
66 . trim ( ) // Trim leading and trailing spaces
77}
8+
9+ // Check if a subset object is a partial match of another object
10+ export const isObjectMatch = < Obj extends Record < string , any > > (
11+ partialObj : Partial < Obj > ,
12+ mainObj : Obj
13+ ) : boolean => {
14+ return Object . keys ( partialObj ) . every (
15+ ( key ) => partialObj [ key as keyof Obj ] === mainObj [ key as keyof Obj ]
16+ )
17+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { Emitter } from '@segment/analytics-generic-utils'
22import { exists } from '../../../lib/exists'
33import { debounceWithKey } from '../../../lib/debounce'
44import { logger } from '../../../lib/logger'
5+ import { isObjectMatch } from './helpers'
56
67const DEFAULT_OBSERVED_ATTRIBUTES = [
78 'aria-pressed' ,
@@ -32,15 +33,6 @@ const DEFAULT_OBSERVED_ROLES = [
3233 'treeitem' ,
3334]
3435
35- // Check if a subset object is a partial match of another object
36- const isObjectMatch = < Obj extends Record < string , any > > (
37- partialObj : Partial < Obj > ,
38- mainObj : Obj
39- ) : boolean => {
40- return Object . keys ( partialObj ) . every (
41- ( key ) => partialObj [ key as keyof Obj ] === mainObj [ key as keyof Obj ]
42- )
43- }
4436type AttributeMutations = { [ attributeName : string ] : string | null }
4537export type AttributeChangedEvent = {
4638 element : HTMLElement
You can’t perform that action at this time.
0 commit comments