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 from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Parameters
- this: Cell<string>
- fwd: (v: string) => string
- bwd: (target: string, current: string) => string
Returns this
Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Parameters
- this: Cell<string>
- ...optics: readonly AppliedOptic<string, string>[]
Returns this
Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Type Parameters
- V1
Returns Writable<Cell<V1>>
- lens<Os extends AnyOptics>(
this: Cell<string>,
...optics: Os,
): Writable<Cell<ChainResult<string, Os>>>Endomorphic lens from a
fwd/bwdpair (2-argbwdreads the source, 1-arg reconstructs it), or apply optic value(s), chaining left-to-right. A chain whose every hop isT → Tstays same-type (returnsthis); a chain that changes the value type yields a plainCellof the final view.Type Parameters
- Os extends AnyOptics
Returns Writable<Cell<ChainResult<string, Os>>>
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>
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, typed to this class.
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), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.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, typed to this class.
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), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Parameters
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P>(
this: C,
parent: Read<P>,
optic: AppliedOptic<P, Inner<InstanceType<C>>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
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), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P extends readonly Read<unknown>[]>(
this: C,
parents: P,
optic: AppliedOptic<ReadValues<P>, Inner<InstanceType<C>>>,
): Writable<InstanceType<C>>Writable lens, typed to this class.
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), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
Returns Writable<InstanceType<C>>
- lens<C extends AnyCellCtor, P, Os extends AnyOptics>(
this: C,
parent: Read<P>,
...optics: Os,
): ChainResult<P, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: neverWritable lens, typed to this class.
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), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P
- Os extends AnyOptics
Returns ChainResult<P, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: never - lens<
C extends AnyCellCtor,
P extends readonly Read<unknown>[],
Os extends AnyOptics,
>(
this: C,
parents: P,
...optics: Os,
): ChainResult<ReadValues<P>, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: neverWritable lens, typed to this class.
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), optic, …)applies an optic value (pure or complement-carrying), chaining left-to-right onto this class.Type Parameters
- C extends AnyCellCtor
- P extends readonly Read<unknown>[]
- Os extends AnyOptics
Returns ChainResult<ReadValues<P>, Os> extends Inner<InstanceType<C>>
? Writable<InstanceType<C>>
: never
Read-only same-type view: the RO dual of the endo
.lens. For a cross-type view use the typed staticTarget.derive(src, fn).