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

ValueOrder overview

This module implements a type that represents an order on the properties of a non-primitive value. A PPValueOrder can be used as the propertySortOrder field of a PPNonPrimitiveParameters so that properties are sorted before being formatted. Several pre-built orderings are provided (by prototypal depth, by key, by callability, by key type, by enumerability, by source). They can be combined with Order.combine from the Effect library if a multi-criteria order is needed.


Table of contents


Models

Type (interface)

Type of a PPValueOrder

Signature

export interface Type extends Order.Order<PPValue.Any> {}

Ordering

byCallability

Order instance based on the callability of the content property (non functions first, then functions)

Signature

export declare const byCallability: Type

byEnumerability

Order instance based on the enumerability of the property to which the value belongs (non- enumerable keys first, then enumerable keys)

Signature

export declare const byEnumerability: Type

byKeyType

Order instance based on the type of the key associated to the value (symbolic keys first, then string keys)

Signature

export declare const byKeyType: Type

byOneLineStringKey

Order instance based on the oneLineStringKey property

Signature

export declare const byOneLineStringKey: Type

byProtoDepth

Order instance based on the protoDepth property, lowest depth first

Signature

export declare const byProtoDepth: Type

bySource

Order instance based on the source of the property (first from iterating on the non primitive value then from Object.ownKeys)

Signature

export declare const bySource: Type