github
448 of 500 branches covered (89.6%)
Branch coverage included in aggregate %.
18 of 72 new or added lines in 7 files covered. (25.0%)
3411 of 3737 relevant lines covered (91.28%)
994.07 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
|
}; |
× |