@parischap/pretty-print
Version:
A functional library to pretty-print and treeify objects
115 lines • 3.5 kB
TypeScript
/**
* Type that represents the output of the stringification process of a value. It is in fact an alias
* for an array of ASText's (see Text.ts in @parischap/ansi-styles). Each elament of the array
* represents a line of the stringified value. There must always be at least one line. But that line
* may contain en empty text.
*/
import { ASText } from '@parischap/ansi-styles';
import { MTypes } from '@parischap/effect-lib';
import { Equivalence, Predicate } from 'effect';
import type * as PPStringifiedProperties from './StringifiedProperties.js';
/**
* Type that represents a StringifiedValue
*
* @category Models
*/
export interface Type extends MTypes.OverOne<ASText.Type> {
}
/**
* Equivalence for StringifiedValue's. To be removed when Equal.equals will handle Arrays properly
* (from Effect 4.0 onwards)
*
* @category Equivalences
*/
export declare const equivalence: Equivalence.Equivalence<Type>;
/**
* Builds a StringifiedValue from a Text
*
* @category Constructors
*/
export declare const fromText: MTypes.OneArgFunction<ASText.Type, Type>;
/**
* Empty StringifiedValue instance
*
* @category Instances
*/
export declare const empty: Type;
/**
* Builds a StringifiedValue from a StringifiedProperties
*
* @category Constructors
*/
export declare const fromStringifiedProperties: MTypes.OneArgFunction<PPStringifiedProperties.Type, Type>;
/**
* Returns a single-line version of `self`
*
* @category Utils
*/
export declare const toSingleLine: MTypes.OneArgFunction<Type>;
/**
* Returns `true` if `self` is empty.
*
* @category Predicates
*/
export declare const isEmpty: Predicate.Predicate<Type>;
/**
* Returns `true` if `self` is not empty.
*
* @category Predicates
*/
export declare const isNotEmpty: Predicate.Predicate<Type>;
/**
* Returns a copy of `self` with a new line at the end
*
* @category Utils
*/
export declare const addLineAfter: (line: ASText.Type) => MTypes.OneArgFunction<Type>;
/**
* Returns a copy of `self` with a new line at the start
*
* @category Utils
*/
export declare const addLineBefore: (line: ASText.Type) => MTypes.OneArgFunction<Type>;
/**
* Returns a copy of `self` in which `text` has been prepended to each line
*
* @category Utils
*/
export declare const prependToAllLines: (text: ASText.Type) => MTypes.OneArgFunction<Type>;
/**
* Returns a copy of `self` in which `text` has been appended to the last line
*
* @category Utils
*/
export declare const appendToLastLine: (text: ASText.Type) => MTypes.OneArgFunction<Type>;
/**
* Returns a copy of `self` in which `text` has been prepended to the first line
*
* @category Utils
*/
export declare const prependToFirstLine: (text: ASText.Type) => MTypes.OneArgFunction<Type>;
/**
* Returns a copy of `self` in which `text` has been prepended to all lines but the first
*
* @category Utils
*/
export declare const prependToTailLines: (text: ASText.Type) => MTypes.OneArgFunction<Type>;
/**
* Returns the length of `self`
*
* @category Destructors
*/
export declare const toLength: MTypes.OneArgFunction<Type, number>;
/**
* Returns the ANSI string corresponding to `self`
*
* @category Destructors
*/
export declare const toAnsiString: (sep?: ASText.Type) => MTypes.OneArgFunction<Type, string>;
/**
* Returns the stringq corresponding to `self` without any styling
*
* @category Destructors
*/
export declare const toUnstyledStrings: MTypes.OneArgFunction<Type, MTypes.OverOne<string>>;
//# sourceMappingURL=StringifiedValue.d.ts.map