github
451 of 503 branches covered (89.66%)
Branch coverage included in aggregate %.
94 of 146 new or added lines in 8 files covered. (64.38%)
6 existing lines in 1 file now uncovered.3416 of 3740 relevant lines covered (91.34%)
995.52 hits per line
NEW
|
import type { AnyCell, MapCell } from "./cell";
|
|
NEW
|
import type { SheetProxy } from "./proxy";
|
× |
NEW
|
|
× |
NEW
|
export const initialValue = <T>( |
× |
NEW
|
proxy: SheetProxy, |
× |
NEW
|
v0: T | AnyCell<T>, |
× |
NEW
|
v: AnyCell<T>, |
× |
NEW
|
name = "initial"
|
× |
NEW
|
): MapCell<T, true> => {
|
× |
NEW
|
const cell = proxy.new(v0, name); |
× |
NEW
|
v.subscribe((v) => { |
× |
NEW
|
// We do not propagate errors yet.
|
× |
NEW
|
if (v instanceof Error) return; |
× |
NEW
|
cell.set(v); |
× |
NEW
|
}); |
× |
NEW
|
// We fake being a MapCell to prevent setting the cell
|
× |
NEW
|
// outside of this function.
|
× |
NEW
|
return cell as unknown as MapCell<T, true>; |
× |
NEW
|
}; |
× |