MCPcopy
hub / github.com/thebuilder/react-intersection-observer / optionsToId

Function optionsToId

src/observe.ts:44–58  ·  view source on GitHub ↗
(options: IntersectionObserverInit)

Source from the content-addressed store, hash-verified

42 * @param options
43 */
44export function optionsToId(options: IntersectionObserverInit) {
45 return Object.keys(options)
46 .sort()
47 .filter(
48 (key) => options[key as keyof IntersectionObserverInit] !== undefined,
49 )
50 .map((key) => {
51 return `${key}_${
52 key === "root"
53 ? getRootId(options.root)
54 : options[key as keyof IntersectionObserverInit]
55 }`;
56 })
57 .toString();
58}
59
60function createObserver(options: IntersectionObserverInit) {
61 // Create a unique ID for this observer instance, based on the root, root margin and threshold.

Callers 2

observe.test.tsFile · 0.90
createObserverFunction · 0.85

Calls 1

getRootIdFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…