PrimitiveFormatter overview
This module implements a type that takes care of the formatting of primitive values, e.g. surround strings in quotes, add ‘n’ at the end of a bigint, display numbers with a thousand separator,…
With the make function, you can define your own instances if the provided ones don’t suit your needs.
Table of contents
Constructors
make
Constructor
Signature
export declare const make: ({ id, action }: { readonly id: string; readonly action: Action.Type }) => Type
utilInspectLikeMaker
PropertyFormatter contructor that builds an instance that works like util.inspect
Signature
export declare const utilInspectLikeMaker: ({
id,
maxStringLength,
numberFormatter
}?: {
readonly id: string
readonly maxStringLength: number
readonly numberFormatter: Intl.NumberFormat
}) => Type
Destructors
id
Returns the id
property of self
Signature
export declare const id: MTypes.OneArgFunction<Type, string>
Equivalences
equivalence
Equivalence
Signature
export declare const equivalence: Equivalence.Equivalence<Type>
Guards
has
Type guard
Signature
export declare const has: (u: unknown) => u is Type
Models
Action (namespace)
Namespace of a PrimitiveFormatter used as an action
Type (interface)
Type of the action of a PrimitiveFormatter. The action takes a Primitive value (see Value.ts) and returns an unstyled string representing that value.
Signature
export interface Type {
(this: PPOption.Type, value: PPValue.Primitive): string
}
Type (interface)
Type that represents a PrimitiveFormatter
Signature
export interface Type extends Action.Type, Equal.Equal, MInspectable.Inspectable, Pipeable.Pipeable {
/** Id of this PrimitiveFormatter instance. Useful for equality and debugging */
readonly id: string
/** @internal */
readonly [_TypeId]: _TypeId
}
moduleTag
Module tag
Signature
export declare const moduleTag: "@parischap/pretty-print/PrimitiveFormatter/"