Class Str
Hierarchy
- Cell<V>
- Str (View Summary)
Methods
derive
Parameters
- this: Cell<string>
- fn: (v: string) => string
Returns this
lens
- lens(
this: Cell<string>,
fwd: (v: string) => string,
bwd: (target: string, current: string) => string,
): thisEndomorphic lens. A 2-arg
bwd(view, current)consults the current source; a 1-argbwd(view)reconstructs it from the view alone.Parameters
- this: Cell<string>
- fwd: (v: string) => string
- bwd: (target: string, current: string) => string
Returns this
merge
peek
Returns string
reverse
Reverse.
Returns this
slice
split
Split into an editable
Arr<string>. Each segment is a positional lens: reading indexire-splits the live source, writing it splices that piece back, so separators need no complement. Structural edits (insert/remove/ move) re-split and rebuild the source; added boundaries usejoiner(defaults tosep, or" "for a pattern). Identity is by position.Parameters
- sep: string | RegExp
Optionaljoiner: string
Returns Arr<string>
through
trim
Staticcoerce
Staticderive
Staticis
Staticlens
- lens<C extends AnyCellCtor, P>(
this: C,
parent: Read<P>,
fwd: (v: P) => Inner<InstanceType<C>>,
bwd: (target: Inner<InstanceType<C>>, v: P) => P,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[]>(
this: C,
parents: P,
fwd: (vals: ReadValues<P>) => Inner<InstanceType<C>>,
bwd: (
target: Inner<InstanceType<C>>,
vals: ReadValues<P>,
) => BackUpdates<ReadValuesOrSkip<P>>,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P, Cm>(
this: C,
parent: Read<P>,
spec: StatefulLensSpec1<P, Inner<InstanceType<C>>, Cm>,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P
- Cm
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[], Cm>(
this: C,
parents: P,
spec: StatefulLensSpec<ReadValues<P>, Inner<InstanceType<C>>, Cm>,
): Writable<InstanceType<C>>Writable lens.
Cls.lens(parent, fwd, bwd)for one input,Cls.lens(parents, fwd, bwd)for N; a 2-argbwdreads the source, a 1-argbwdreconstructs it.Cls.lens(parent(s), spec)builds a complement-carrying lens from{ init, step, fwd, bwd }.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
- Cm
Returns Writable<InstanceType<C>>
Read-only same-type view: the RO dual of the endo
.lens. For a cross-type view use the typed staticTarget.derive(src, fn).