UNPKG

@parischap/pretty-print

Version:
117 lines (115 loc) 3.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.utilInspectLike = exports.moduleTag = exports.marks = exports.make = exports.id = exports.has = exports.equivalence = void 0; var _effectLib = /*#__PURE__*/require("@parischap/effect-lib"); var _effect = /*#__PURE__*/require("effect"); /** * This module implements a map of the different marks that appear in a value to stringify. * * With the make function, you can define your own instances if the provided ones don't suit your * needs. */ /** * Module tag * * @category Models */ const moduleTag = exports.moduleTag = '@parischap/pretty-print/MarkMap/'; const _TypeId = /*#__PURE__*/Symbol.for(moduleTag); /** * Type guard * * @category Guards */ const has = u => _effect.Predicate.hasProperty(u, _TypeId); /** * Equivalence * * @category Equivalences */ exports.has = has; const equivalence = (self, that) => that.id === self.id; /** Prototype */ exports.equivalence = equivalence; const _TypeIdHash = /*#__PURE__*/_effect.Hash.hash(_TypeId); const proto = { [_TypeId]: _TypeId, [_effect.Equal.symbol](that) { return has(that) && equivalence(this, that); }, [_effect.Hash.symbol]() { return (0, _effect.pipe)(this.id, _effect.Hash.hash, _effect.Hash.combine(_TypeIdHash), _effect.Hash.cached(this)); }, [_effectLib.MInspectable.IdSymbol]() { return this.id; }, ... /*#__PURE__*/_effectLib.MInspectable.BaseProto(moduleTag), ..._effectLib.MPipeable.BaseProto }; /** * Constructor * * @category Constructors */ const make = params => _effectLib.MTypes.objectFromDataAndProto(proto, params); /** * Returns the `id` property of `self` * * @category Destructors */ exports.make = make; const id = exports.id = /*#__PURE__*/_effect.Struct.get('id'); /** * Returns the `marks` property of `self` * * @category Destructors */ const marks = exports.marks = /*#__PURE__*/_effect.Struct.get('marks'); /** * Default MarkMap instance * * @category Instances */ const utilInspectLike = exports.utilInspectLike = /*#__PURE__*/make({ id: 'Defaults', marks: /*#__PURE__*/_effect.HashMap.make(['FunctionNameStartDelimiter', { text: 'Function: ', partName: 'Message' }], ['FunctionNameEndDelimiter', { text: '', partName: 'Message' }], ['MessageStartDelimiter', { text: '[', partName: 'Message' }], ['MessageEndDelimiter', { text: ']', partName: 'Message' }], ['CircularObject', { text: 'Circular *', partName: 'Message' }], ['CircularReferenceStartDelimiter', { text: '<Ref *', partName: 'Message' }], ['CircularReferenceEndDelimiter', { text: '> ', partName: 'Message' }], ['TabIndent', { text: ' ', partName: 'Indentation' }], ['TreeIndentForFirstLineOfInitProps', { text: '├─ ', partName: 'Indentation' }], ['TreeIndentForTailLinesOfInitProps', { text: '│ ', partName: 'Indentation' }], ['TreeIndentForFirstLineOfLastProp', { text: '└─ ', partName: 'Indentation' }], ['TreeIndentForTailLinesOfLastProp', { text: ' ', partName: 'Indentation' }]) }); //# sourceMappingURL=MarkMap.js.map