( prev: Screen, next: Screen, )
| 1457 | * Production code should use diffEach() to avoid allocations. |
| 1458 | */ |
| 1459 | export function diff( |
| 1460 | prev: Screen, |
| 1461 | next: Screen, |
| 1462 | ): [point: Point, removed: Cell | undefined, added: Cell | undefined][] { |
| 1463 | const output: [Point, Cell | undefined, Cell | undefined][] = [] |
| 1464 | diffEach(prev, next, (x, y, removed, added) => { |
| 1465 | // Copy cells since diffEach reuses the objects |
| 1466 | output.push([ |
| 1467 | { x, y }, |
| 1468 | removed ? { ...removed } : undefined, |
| 1469 | added ? { ...added } : undefined, |
| 1470 | ]) |
| 1471 | }) |
| 1472 | return output |
| 1473 | } |
| 1474 | |
| 1475 | type DiffCallback = ( |
| 1476 | x: number, |
nothing calls this directly
no test coverage detected