Skip to main content Link Search Menu Expand Document (external link)

StringFillPosition overview

Two-valued enum used by string-padding helpers to choose the side that gets filled.

Mental model

  • Type.Left indicates that filler is added on the left of the source string (the characters of self end up flush right).
  • Type.Right indicates the symmetric case.
  • Pair this enum with {@link “./String.js” MString.pad} / MString.trim.

Quickstart

Example (Right-aligned padding)

import { pipe } from "effect"
import * as MString from "@parischap/effect-lib/MString"
import * as MStringFillPosition from "@parischap/effect-lib/String/StringFillPosition"

console.log(pipe("42", MString.pad({ length: 5, fillChar: "0", fillPosition: MStringFillPosition.Type.Left })))
// '00042'

Table of contents


Destructors

toString

Returns the lowercase string representation of self ('left' or 'right').

Example

import * as MStringFillPosition from "@parischap/effect-lib/String/StringFillPosition"

console.log(MStringFillPosition.toString(MStringFillPosition.Type.Left)) // 'left'

Signature

export declare const toString: MTypes.OneArgFunction<Type, string>