StyleMap.ts overview
This module implements a named, inspectable map from PPPartName values to PPStyle’s (see Style.ts). A PPStyleMap therefore defines which style to apply to each visual element of a stringified value. Two pre-built instances are provided: - none: no styling applied. - darkMode: a color scheme suited to dark-mode terminals.
Use the make function to define custom instances if the pre-built ones do not suit your needs.
Exports Grouped by Category
Constructors
make
Constructor of a PPStyleMap
Signature
declare const make: (params: MTypes.Data<Type>) => Type
Destructors
get
Returns the Style associated with partName which identifies a part of a stringified value. Returns ASContextStyler.none if partName is not present in self.
Signature
declare const get: (partName: PPPartName.Type) => MTypes.OneArgFunction<Type, PPStyle.Type>
Equivalences
equivalence
Equivalence
Signature
declare const equivalence: Equivalence.Equivalence<Type>
Getters
id
Returns the id property of self
Signature
declare const id: MTypes.OneArgFunction<Type, string>
styles
Returns the styles property of self
Signature
declare const styles: MTypes.OneArgFunction<Type, PPStyles.Type>
Instances
darkMode
StyleMap instance for ansi dark mode
Signature
declare const darkMode: Type
none
StyleMap instance that doesn’t apply any formatting (uses the none ASContextStyler of the ansi- styles library for all parts to be formatted)
Signature
declare const none: Type
Models
Type (class)
Type that represents a PPStyleMap
Signature
declare class Type {
private constructor({ id, styles }: MTypes.Data<Type>)
}
make (static method)
Static constructor
Signature
declare const make: (params: MTypes.Data<Type>) => Type
[MData.idSymbol] (method)
Returns the id of this
Signature
declare const [MData.idSymbol]: () => string | (() => string)
[Hash.symbol] (method)
Calculates the hash value of this
Signature
declare const [Hash.symbol]: () => number
[MEquivalenceBasedEqualityData.isEquivalentToSymbol] (method)
Function that implements the equivalence of this and that
Signature
declare const [MEquivalenceBasedEqualityData.isEquivalentToSymbol]: (this: this, that: this) => boolean
[MEquivalenceBasedEqualityData.hasSameTypeMarkerAsSymbol] (method)
Predicate that returns true if that has the same type marker as this
Signature
declare const [MEquivalenceBasedEqualityData.hasSameTypeMarkerAsSymbol]: (that: unknown) => boolean
id (property)
Id of this PPStyleMap instance. Useful for equality and debugging.
Signature
readonly id: string
styles (property)
Map of Style’s to be applied to the different parts of the value to stringify
Signature
readonly styles: PPStyles.Type
Module markers
moduleTag
Module tag
Signature
declare const moduleTag: "@parischap/pretty-print/Parameters/StyleMap/"