( oldValue: HashSet.HashSet<Value>, newValue: HashSet.HashSet<Value> )
| 101 | |
| 102 | /** @internal */ |
| 103 | export const diff = <Value>( |
| 104 | oldValue: HashSet.HashSet<Value>, |
| 105 | newValue: HashSet.HashSet<Value> |
| 106 | ): Differ.HashSet.Patch<Value> => { |
| 107 | const [removed, patch] = HashSet.reduce( |
| 108 | [oldValue, empty<Value>()] as const, |
| 109 | ([set, patch], value: Value) => { |
| 110 | if (HashSet.has(value)(set)) { |
| 111 | return [HashSet.remove(value)(set), patch] as const |
| 112 | } |
| 113 | return [set, combine(makeAdd(value))(patch)] as const |
| 114 | } |
| 115 | )(newValue) |
| 116 | return HashSet.reduce(patch, (patch, value: Value) => combine(makeRemove(value))(patch))(removed) |
| 117 | } |
| 118 | |
| 119 | /** @internal */ |
| 120 | export const combine = Dual.dual< |
nothing calls this directly
no test coverage detected
searching dependent graphs…