Interface FieldSpecObject<ObjectType, FieldName, FieldType>

Specifies advanced sorting behavior for a given field.

interface FieldSpecObject<ObjectType, FieldName, FieldType> {
    compare?: Comparator<FieldType>;
    field?: FieldName;
    reverse?: boolean;
    valuePicker?: ((instance) => undefined | FieldType);
}

Type Parameters

  • ObjectType
  • FieldName extends string | number | symbol
  • FieldType

Properties

Custom comparator function used for values of this field (optional).

field?: FieldName

The field name to sort by. Numbers can be used for array indices.

reverse?: boolean

To reverse the sort order (default: false).

valuePicker?: ((instance) => undefined | FieldType)

Custom value picker, used to lookup the field in the target instance. If defined, the field name can be skipped. Allows default values to be provided.

Type declaration

Returns

value to compare.

Generated using TypeDoc