MCPcopy Create free account
hub / github.com/codeaashu/claude-code / shallowEqual

Function shallowEqual

src/ink/dom.ts:295–316  ·  view source on GitHub ↗
(
  a: T | undefined,
  b: T | undefined,
)

Source from the content-addressed store, hash-verified

293}
294
295function shallowEqual<T extends object>(
296 a: T | undefined,
297 b: T | undefined,
298): boolean {
299 // Fast path: same object reference (or both undefined)
300 if (a === b) return true
301 if (a === undefined || b === undefined) return false
302
303 // Get all keys from both objects
304 const aKeys = Object.keys(a) as (keyof T)[]
305 const bKeys = Object.keys(b) as (keyof T)[]
306
307 // Different number of properties
308 if (aKeys.length !== bKeys.length) return false
309
310 // Compare each property
311 for (const key of aKeys) {
312 if (a[key] !== b[key]) return false
313 }
314
315 return true
316}
317
318export const createTextNode = (text: string): TextNode => {
319 const node: TextNode = {

Callers 2

setTextStylesFunction · 0.85
stylesEqualFunction · 0.85

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected