@parischap/pretty-print
Version:
A functional library to pretty-print and treeify objects
38 lines • 1.43 kB
JavaScript
/** Module that implements an Order on Value.All */
import { MTypes } from '@parischap/effect-lib';
import { flow, Order } from 'effect';
import * as PPValue from './Value.js';
/**
* Order instance based on the `protoDepth` property, lowest depth first
*
* @category Ordering
*/
export const byProtoDepth = /*#__PURE__*/Order.mapInput(Order.number, PPValue.protoDepth);
/**
* Order instance based on the `oneLineStringKey` property
*
* @category Ordering
*/
export const byOneLineStringKey = /*#__PURE__*/Order.mapInput(Order.string, PPValue.oneLineStringKey);
/**
* Order instance based on the callability of the `content` property (non functions first, then
* functions)
*
* @category Ordering
*/
export const byCallability = /*#__PURE__*/Order.mapInput(Order.boolean, /*#__PURE__*/flow(PPValue.contentType, MTypes.Category.isFunction));
/**
* Order instance based on the type of the key associated to the value (symbolic keys first, then
* string keys)
*
* @category Ordering
*/
export const byKeyType = /*#__PURE__*/Order.mapInput(/*#__PURE__*/Order.reverse(Order.boolean), PPValue.hasSymbolicKey);
/**
* Order instance based on the enumerability of the property to which the value belongs
* (non-enumerable keys first, then enumerable keys)
*
* @category Ordering
*/
export const byEnumerability = /*#__PURE__*/Order.mapInput(Order.boolean, PPValue.isEnumerable);
//# sourceMappingURL=ValueOrder.js.map