@parischap/conversions 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1304 -0
  3. package/cjs/BigDecimal.js +16 -0
  4. package/cjs/BigDecimal.js.map +1 -0
  5. package/cjs/BigInt.js +34 -0
  6. package/cjs/BigInt.js.map +1 -0
  7. package/cjs/DateTime.js +2202 -0
  8. package/cjs/DateTime.js.map +1 -0
  9. package/cjs/DateTimeFormat.js +269 -0
  10. package/cjs/DateTimeFormat.js.map +1 -0
  11. package/cjs/DateTimeFormatContext.js +327 -0
  12. package/cjs/DateTimeFormatContext.js.map +1 -0
  13. package/cjs/Email.js +73 -0
  14. package/cjs/Email.js.map +1 -0
  15. package/cjs/Integer.js +155 -0
  16. package/cjs/Integer.js.map +1 -0
  17. package/cjs/NumberBase10Format.js +759 -0
  18. package/cjs/NumberBase10Format.js.map +1 -0
  19. package/cjs/PositiveInteger.js +191 -0
  20. package/cjs/PositiveInteger.js.map +1 -0
  21. package/cjs/PositiveReal.js +162 -0
  22. package/cjs/PositiveReal.js.map +1 -0
  23. package/cjs/Real.js +113 -0
  24. package/cjs/Real.js.map +1 -0
  25. package/cjs/RoundingMode.js +86 -0
  26. package/cjs/RoundingMode.js.map +1 -0
  27. package/cjs/RoundingOption.js +152 -0
  28. package/cjs/RoundingOption.js.map +1 -0
  29. package/cjs/Schema.js +218 -0
  30. package/cjs/Schema.js.map +1 -0
  31. package/cjs/SemVer.js +73 -0
  32. package/cjs/SemVer.js.map +1 -0
  33. package/cjs/Template.js +189 -0
  34. package/cjs/Template.js.map +1 -0
  35. package/cjs/TemplatePart.js +51 -0
  36. package/cjs/TemplatePart.js.map +1 -0
  37. package/cjs/TemplateParts.js +46 -0
  38. package/cjs/TemplateParts.js.map +1 -0
  39. package/cjs/TemplatePlaceholder.js +381 -0
  40. package/cjs/TemplatePlaceholder.js.map +1 -0
  41. package/cjs/TemplateSeparator.js +116 -0
  42. package/cjs/TemplateSeparator.js.map +1 -0
  43. package/cjs/index.js +67 -0
  44. package/cjs/index.js.map +1 -0
  45. package/cjs/internal/Int.js +50 -0
  46. package/cjs/internal/Int.js.map +1 -0
  47. package/cjs/internal/Positive.js +50 -0
  48. package/cjs/internal/Positive.js.map +1 -0
  49. package/dts/BigDecimal.d.ts +11 -0
  50. package/dts/BigDecimal.d.ts.map +1 -0
  51. package/dts/BigInt.d.ts +30 -0
  52. package/dts/BigInt.d.ts.map +1 -0
  53. package/dts/DateTime.d.ts +1421 -0
  54. package/dts/DateTime.d.ts.map +1 -0
  55. package/dts/DateTimeFormat.d.ts +257 -0
  56. package/dts/DateTimeFormat.d.ts.map +1 -0
  57. package/dts/DateTimeFormatContext.d.ts +112 -0
  58. package/dts/DateTimeFormatContext.d.ts.map +1 -0
  59. package/dts/Email.d.ts +61 -0
  60. package/dts/Email.d.ts.map +1 -0
  61. package/dts/Integer.d.ts +123 -0
  62. package/dts/Integer.d.ts.map +1 -0
  63. package/dts/NumberBase10Format.d.ts +641 -0
  64. package/dts/NumberBase10Format.d.ts.map +1 -0
  65. package/dts/PositiveInteger.d.ts +161 -0
  66. package/dts/PositiveInteger.d.ts.map +1 -0
  67. package/dts/PositiveReal.d.ts +130 -0
  68. package/dts/PositiveReal.d.ts.map +1 -0
  69. package/dts/Real.d.ts +102 -0
  70. package/dts/Real.d.ts.map +1 -0
  71. package/dts/RoundingMode.d.ts +72 -0
  72. package/dts/RoundingMode.d.ts.map +1 -0
  73. package/dts/RoundingOption.d.ts +79 -0
  74. package/dts/RoundingOption.d.ts.map +1 -0
  75. package/dts/Schema.d.ts +159 -0
  76. package/dts/Schema.d.ts.map +1 -0
  77. package/dts/SemVer.d.ts +61 -0
  78. package/dts/SemVer.d.ts.map +1 -0
  79. package/dts/Template.d.ts +113 -0
  80. package/dts/Template.d.ts.map +1 -0
  81. package/dts/TemplatePart.d.ts +28 -0
  82. package/dts/TemplatePart.d.ts.map +1 -0
  83. package/dts/TemplateParts.d.ts +23 -0
  84. package/dts/TemplateParts.d.ts.map +1 -0
  85. package/dts/TemplatePlaceholder.d.ts +274 -0
  86. package/dts/TemplatePlaceholder.d.ts.map +1 -0
  87. package/dts/TemplateSeparator.d.ts +130 -0
  88. package/dts/TemplateSeparator.d.ts.map +1 -0
  89. package/dts/index.d.ts +21 -0
  90. package/dts/index.d.ts.map +1 -0
  91. package/dts/internal/Int.d.ts +6 -0
  92. package/dts/internal/Int.d.ts.map +1 -0
  93. package/dts/internal/Positive.d.ts +6 -0
  94. package/dts/internal/Positive.d.ts.map +1 -0
  95. package/esm/BigDecimal.js +9 -0
  96. package/esm/BigDecimal.js.map +1 -0
  97. package/esm/BigInt.js +27 -0
  98. package/esm/BigInt.js.map +1 -0
  99. package/esm/DateTime.js +2130 -0
  100. package/esm/DateTime.js.map +1 -0
  101. package/esm/DateTimeFormat.js +238 -0
  102. package/esm/DateTimeFormat.js.map +1 -0
  103. package/esm/DateTimeFormatContext.js +296 -0
  104. package/esm/DateTimeFormatContext.js.map +1 -0
  105. package/esm/Email.js +65 -0
  106. package/esm/Email.js.map +1 -0
  107. package/esm/Integer.js +128 -0
  108. package/esm/Integer.js.map +1 -0
  109. package/esm/NumberBase10Format.js +717 -0
  110. package/esm/NumberBase10Format.js.map +1 -0
  111. package/esm/PositiveInteger.js +164 -0
  112. package/esm/PositiveInteger.js.map +1 -0
  113. package/esm/PositiveReal.js +135 -0
  114. package/esm/PositiveReal.js.map +1 -0
  115. package/esm/Real.js +106 -0
  116. package/esm/Real.js.map +1 -0
  117. package/esm/RoundingMode.js +79 -0
  118. package/esm/RoundingMode.js.map +1 -0
  119. package/esm/RoundingOption.js +120 -0
  120. package/esm/RoundingOption.js.map +1 -0
  121. package/esm/Schema.js +203 -0
  122. package/esm/Schema.js.map +1 -0
  123. package/esm/SemVer.js +65 -0
  124. package/esm/SemVer.js.map +1 -0
  125. package/esm/Template.js +158 -0
  126. package/esm/Template.js.map +1 -0
  127. package/esm/TemplatePart.js +22 -0
  128. package/esm/TemplatePart.js.map +1 -0
  129. package/esm/TemplateParts.js +19 -0
  130. package/esm/TemplateParts.js.map +1 -0
  131. package/esm/TemplatePlaceholder.js +342 -0
  132. package/esm/TemplatePlaceholder.js.map +1 -0
  133. package/esm/TemplateSeparator.js +107 -0
  134. package/esm/TemplateSeparator.js.map +1 -0
  135. package/esm/index.js +21 -0
  136. package/esm/index.js.map +1 -0
  137. package/esm/internal/Int.js +43 -0
  138. package/esm/internal/Int.js.map +1 -0
  139. package/esm/internal/Positive.js +43 -0
  140. package/esm/internal/Positive.js.map +1 -0
  141. package/esm/package.json +3 -0
  142. package/package.json +49 -0
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toThrowingParser = exports.toThrowingFormatter = exports.toParser = exports.toFormatter = exports.templateParts = exports.moduleTag = exports.make = exports.has = void 0;
7
+ var _effectLib = /*#__PURE__*/require("@parischap/effect-lib");
8
+ var _effect = /*#__PURE__*/require("effect");
9
+ var CVTemplatePart = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./TemplatePart.js"));
10
+ var CVTemplateParts = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./TemplateParts.js"));
11
+ function _interopRequireWildcard(e, t) {
12
+ if ("function" == typeof WeakMap) var r = new WeakMap(),
13
+ n = new WeakMap();
14
+ return (_interopRequireWildcard = function (e, t) {
15
+ if (!t && e && e.__esModule) return e;
16
+ var o,
17
+ i,
18
+ f = {
19
+ __proto__: null,
20
+ default: e
21
+ };
22
+ if (null === e || "object" != typeof e && "function" != typeof e) return f;
23
+ if (o = t ? n : r) {
24
+ if (o.has(e)) return o.get(e);
25
+ o.set(e, f);
26
+ }
27
+ for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
28
+ return f;
29
+ })(e, t);
30
+ }
31
+ /**
32
+ * A template is a model of a text that has always the same structure. In such a text, there are
33
+ * immutable and mutable parts. Let's take the following two texts as an example:
34
+ *
35
+ * - Text1 = "John is a 47-year old man."
36
+ * - Text2 = "Jehnny is a 5-year old girl."
37
+ *
38
+ * These two texts obviously share the same structure which is the template:
39
+ *
40
+ * Placeholder1 is a Placeholder2-year old Placeholder3.
41
+ *
42
+ * Placeholder1, Placeholder2 and Placeholder3 are the mutable parts of the template. They contain
43
+ * valuable information. We call them `TemplatePlaceholder`'s.
44
+ *
45
+ * " is a " and "-year old " are the immutable parts of the template. We call them
46
+ * `TemplateSeperator`'s.
47
+ *
48
+ * From a text with the above structure, we can extract the values of Placeholder1, Placeholder2,
49
+ * and Placeholder3. In the present case:
50
+ *
51
+ * - For text1: Placeholder1 = 'John', Placeholder2 = '47', Placeholder3 = 'man'
52
+ * - For text2: Placeholder1 = 'Jehnny', Placeholder2 = '5', Placeholder3 = 'girl'
53
+ *
54
+ * Extracting the values of placeholders from a text according to a template is called parsing.
55
+ *
56
+ * Inversely, given a template and the values of the placeholders that compose it, we can generate a
57
+ * text. This is called formatting. In the present case, with:
58
+ *
59
+ * Placeholder1 = 'Tom', Placeholder2 = '15', Placeholder3 = 'boy'
60
+ *
61
+ * We will obtain the text: "Tom is a 15-year old boy."
62
+ *
63
+ * A TemplatePart is either a TemplateSeparator or a TemplatePlaceholder. This module implements a
64
+ * Template which is composed of a series of TemplatePart's. Note that Effect does provide the
65
+ * Schema.TemplateLiteralParser API which partly addresses the same problem. But there are some
66
+ * limitations to that API. For instance, template literal types cannot represent a fixed-length
67
+ * string or a string composed only of capital letters... It is for instance impossible to represent
68
+ * a date in the form YYYYMMDD with the TemplateLiteralParser. A schema in the form:
69
+ *
70
+ * `const schema = Schema.TemplateLiteralParser(Schema.NumberFromString,Schema.NumberFromString,
71
+ * Schema.NumberFromString)`
72
+ *
73
+ * Would not work as the first NumberFromString combinator would read the whole date.
74
+ */
75
+
76
+ /**
77
+ * Module tag
78
+ *
79
+ * @category Module markers
80
+ */
81
+ const moduleTag = exports.moduleTag = '@parischap/conversions/Template/';
82
+ const _TypeId = /*#__PURE__*/Symbol.for(moduleTag);
83
+ /**
84
+ * Type guard
85
+ *
86
+ * @category Guards
87
+ */
88
+ const has = u => _effect.Predicate.hasProperty(u, _TypeId);
89
+ /** Prototype */
90
+ exports.has = has;
91
+ const proto = {
92
+ [_TypeId]: {
93
+ _P: _effectLib.MTypes.covariantValue
94
+ },
95
+ [_effectLib.MInspectable.IdSymbol]() {
96
+ return (0, _effect.pipe)(this.templateParts, _effectLib.MTuple.makeBothBy({
97
+ toFirst: CVTemplateParts.getSyntheticDescription,
98
+ toSecond: CVTemplateParts.getPlaceholderDescription
99
+ }), _effect.Array.join('\n\n'));
100
+ },
101
+ ... /*#__PURE__*/_effectLib.MInspectable.BaseProto(moduleTag),
102
+ ..._effectLib.MPipeable.BaseProto
103
+ };
104
+ const _make = params => _effectLib.MTypes.objectFromDataAndProto(proto, params);
105
+ /**
106
+ * Constructor
107
+ *
108
+ * @category Constructors
109
+ */
110
+ const make = (...templateParts) => _make({
111
+ templateParts
112
+ });
113
+ /**
114
+ * Returns the `templateParts` property of `self`
115
+ *
116
+ * @category Destructors
117
+ */
118
+ exports.make = make;
119
+ const templateParts = exports.templateParts = /*#__PURE__*/_effect.Struct.get('templateParts');
120
+ /**
121
+ * Returns a function that parses a text into a record according to 'self' .
122
+ *
123
+ * @category Parsing
124
+ */
125
+ const toParser = self => text => _effect.Either.gen(function* () {
126
+ let consumed;
127
+ const result = _effect.Record.empty();
128
+ const templateParts = self.templateParts;
129
+ for (let pos = 0; pos < templateParts.length; pos++) {
130
+ const templatePart = templateParts[pos];
131
+ if (CVTemplatePart.isPlaceholder(templatePart)) {
132
+ /* eslint-disable-next-line functional/no-expression-statements */
133
+ [consumed, text] = yield* templatePart.parser(text);
134
+ const name = templatePart.name;
135
+ if (!(name in result)) /* eslint-disable-next-line functional/immutable-data, functional/no-expression-statements, */
136
+ result[name] = consumed;else {
137
+ const oldValue = result[name];
138
+ if (!_effect.Equal.equals(oldValue, consumed)) yield* _effect.Either.left(new _effectLib.MInputError.Type({
139
+ message: `${templatePart.label} is present more than once in template and receives differing values '${_effectLib.MString.fromUnknown(oldValue)}' and '${_effectLib.MString.fromUnknown(consumed)}'`
140
+ }));
141
+ }
142
+ } else /* eslint-disable-next-line functional/no-expression-statements */
143
+ text = yield* templatePart.parser(pos + 1)(text);
144
+ }
145
+ yield* (0, _effect.pipe)(text, _effectLib.MInputError.assertEmpty({
146
+ name: 'text not consumed by template'
147
+ }));
148
+ return result;
149
+ });
150
+ /**
151
+ * Same as toParser but the returned parser throws in case of error
152
+ *
153
+ * @category Parsing
154
+ */
155
+ exports.toParser = toParser;
156
+ const toThrowingParser = exports.toThrowingParser = /*#__PURE__*/(0, _effect.flow)(toParser, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
157
+ /**
158
+ * Returns a function that formats an object into the template represented by 'self' . When
159
+ * strictMode is false, the formatter function of the templatepart's is replaced by the Either.right
160
+ * function, i.e. no checks are carried out when encoding
161
+ *
162
+ * @category Formatting
163
+ */
164
+ const toFormatter = self => {
165
+ return record => _effect.Either.gen(function* () {
166
+ let result = '';
167
+ for (const templatePart of self.templateParts) {
168
+ if (CVTemplatePart.isSeparator(templatePart)) {
169
+ /* eslint-disable-next-line functional/no-expression-statements */
170
+ result += templatePart.formatter();
171
+ } else {
172
+ const value = (0, _effect.pipe)(record, _effect.Record.get(templatePart.name),
173
+ // This error should not happen due to typing
174
+ _effect.Option.getOrThrowWith(() => new Error(`Abnormal error: no value passed for ${templatePart.label} templatepart`)));
175
+ /* eslint-disable-next-line functional/no-expression-statements */
176
+ result += yield* templatePart.formatter(value);
177
+ }
178
+ }
179
+ return result;
180
+ });
181
+ };
182
+ /**
183
+ * Same as toFormatter but the returned formatter throws in case of error
184
+ *
185
+ * @category Formatting
186
+ */
187
+ exports.toFormatter = toFormatter;
188
+ const toThrowingFormatter = exports.toThrowingFormatter = /*#__PURE__*/(0, _effect.flow)(toFormatter, /*#__PURE__*/_effect.Function.compose(/*#__PURE__*/_effect.Either.getOrThrowWith(_effect.Function.identity)));
189
+ //# sourceMappingURL=Template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Template.js","names":["_effectLib","require","_effect","CVTemplatePart","_interopRequireWildcard","CVTemplateParts","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","moduleTag","exports","_TypeId","Symbol","for","u","Predicate","hasProperty","proto","_P","MTypes","covariantValue","MInspectable","IdSymbol","pipe","templateParts","MTuple","makeBothBy","toFirst","getSyntheticDescription","toSecond","getPlaceholderDescription","Array","join","BaseProto","MPipeable","_make","params","objectFromDataAndProto","make","Struct","toParser","self","text","Either","gen","consumed","result","Record","empty","pos","length","templatePart","isPlaceholder","parser","name","oldValue","Equal","equals","left","MInputError","Type","message","label","MString","fromUnknown","assertEmpty","toThrowingParser","flow","Function","compose","getOrThrowWith","identity","toFormatter","record","isSeparator","formatter","value","Option","Error","toThrowingFormatter"],"sources":["../../esm/Template.ts"],"sourcesContent":[null],"mappings":";;;;;;AA6CA,IAAAA,UAAA,gBAAAC,OAAA;AAQA,IAAAC,OAAA,gBAAAD,OAAA;AAcA,IAAAE,cAAA,gBAAAC,uBAAA,cAAAH,OAAA;AACA,IAAAI,eAAA,gBAAAD,uBAAA,cAAAH,OAAA;AAAsD,SAAAG,wBAAAE,CAAA,EAAAC,CAAA;EAAA,yBAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA;IAAAE,CAAA,OAAAF,OAAA;EAAA,QAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA;IAAA,KAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA;IAAA,IAAAM,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+ });
6
+ exports.isSeparator = exports.isPlaceholder = void 0;
7
+ var CVTemplatePlaceholder = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./TemplatePlaceholder.js"));
8
+ var CVTemplateSeparator = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./TemplateSeparator.js"));
9
+ function _interopRequireWildcard(e, t) {
10
+ if ("function" == typeof WeakMap) var r = new WeakMap(),
11
+ n = new WeakMap();
12
+ return (_interopRequireWildcard = function (e, t) {
13
+ if (!t && e && e.__esModule) return e;
14
+ var o,
15
+ i,
16
+ f = {
17
+ __proto__: null,
18
+ default: e
19
+ };
20
+ if (null === e || "object" != typeof e && "function" != typeof e) return f;
21
+ if (o = t ? n : r) {
22
+ if (o.has(e)) return o.get(e);
23
+ o.set(e, f);
24
+ }
25
+ for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
26
+ return f;
27
+ })(e, t);
28
+ }
29
+ /**
30
+ * This module implements a TemplatePart type. TemplatePart's are the constituents of Template's
31
+ * (see Template.ts).
32
+ *
33
+ * There are two kinds of TemplateParts: TemplateSeparator's (see TemplateSeparator.ts) and
34
+ * TemplatePlaceholder's (see TemplatePlaceholder.ts)
35
+ */
36
+
37
+ /**
38
+ * Type guard
39
+ *
40
+ * @category Guards
41
+ */
42
+ const isPlaceholder = u => CVTemplatePlaceholder.has(u);
43
+ /**
44
+ * Type guard
45
+ *
46
+ * @category Guards
47
+ */
48
+ exports.isPlaceholder = isPlaceholder;
49
+ const isSeparator = u => CVTemplateSeparator.has(u);
50
+ exports.isSeparator = isSeparator;
51
+ //# sourceMappingURL=TemplatePart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplatePart.js","names":["CVTemplatePlaceholder","_interopRequireWildcard","require","CVTemplateSeparator","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","isPlaceholder","u","exports","isSeparator"],"sources":["../../esm/TemplatePart.ts"],"sourcesContent":[null],"mappings":";;;;;;AAQA,IAAAA,qBAAA,gBAAAC,uBAAA,cAAAC,OAAA;AACA,IAAAC,mBAAA,gBAAAF,uBAAA,cAAAC,OAAA;AAA8D,SAAAD,wBAAAG,CAAA,EAAAC,CAAA;EAAA,yBAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA;IAAAE,CAAA,OAAAF,OAAA;EAAA,QAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA;IAAA,KAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA;IAAA,IAAAM,CAAA;MAAAC,CAAA;MAAAC,CAAA;QAAAC,SAAA;QAAAC,OAAA,EAAAV;MAAA;IAAA,aAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA;IAAA,IAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA;MAAA,IAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA;MAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA;IAAA;IAAA,WAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA;IAAA,OAAAO,CAAA;EAAA,GAAAR,CAAA,EAAAC,CAAA;AAAA;AAT9D;;;;;;;;AAkBA;;;;;AAKO,MAAMkB,aAAa,GACzBC,CAAa,IAC8BxB,qBAAqB,CAACe,GAAG,CAACS,CAAC,CAAC;AAExE;;;;;AAAAC,OAAA,CAAAF,aAAA,GAAAA,aAAA;AAKO,MAAMG,WAAW,GACvBF,CAAa,IACsBrB,mBAAmB,CAACY,GAAG,CAACS,CAAC,CAAC;AAACC,OAAA,CAAAC,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getSyntheticDescription = exports.getPlaceholderDescription = void 0;
7
+ var _effectLib = /*#__PURE__*/require("@parischap/effect-lib");
8
+ var _effect = /*#__PURE__*/require("effect");
9
+ var CVTemplatePart = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./TemplatePart.js"));
10
+ var CVTemplatePlaceholder = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./TemplatePlaceholder.js"));
11
+ var CVTemplateSeparator = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./TemplateSeparator.js"));
12
+ function _interopRequireWildcard(e, t) {
13
+ if ("function" == typeof WeakMap) var r = new WeakMap(),
14
+ n = new WeakMap();
15
+ return (_interopRequireWildcard = function (e, t) {
16
+ if (!t && e && e.__esModule) return e;
17
+ var o,
18
+ i,
19
+ f = {
20
+ __proto__: null,
21
+ default: e
22
+ };
23
+ if (null === e || "object" != typeof e && "function" != typeof e) return f;
24
+ if (o = t ? n : r) {
25
+ if (o.has(e)) return o.get(e);
26
+ o.set(e, f);
27
+ }
28
+ for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);
29
+ return f;
30
+ })(e, t);
31
+ }
32
+ /** This module implements an array of TemplatePart's (see TemplatePart.ts) */
33
+
34
+ /**
35
+ * Shows a synthetic description of `self`, e.g.' #name is a #age-year-old #kind.'
36
+ *
37
+ * @category Destructors
38
+ */
39
+ const getSyntheticDescription = exports.getSyntheticDescription = /*#__PURE__*/(0, _effect.flow)(/*#__PURE__*/_effect.Array.map(/*#__PURE__*/(0, _effect.flow)(_effectLib.MMatch.make, /*#__PURE__*/_effectLib.MMatch.when(CVTemplatePart.isPlaceholder, CVTemplatePlaceholder.label), /*#__PURE__*/_effectLib.MMatch.when(CVTemplatePart.isSeparator, CVTemplateSeparator.value), _effectLib.MMatch.exhaustive)), /*#__PURE__*/_effect.Array.join(''));
40
+ /**
41
+ * Shows a description of the placeholders of `self`, e.g.' #name is a #age-year-old #kind.'
42
+ *
43
+ * @category Destructors
44
+ */
45
+ const getPlaceholderDescription = exports.getPlaceholderDescription = /*#__PURE__*/(0, _effect.flow)(/*#__PURE__*/_effect.Array.filterMap(/*#__PURE__*/(0, _effect.flow)(_effectLib.MMatch.make, /*#__PURE__*/_effectLib.MMatch.when(CVTemplatePart.isPlaceholder, /*#__PURE__*/(0, _effect.flow)(CVTemplatePlaceholder.getLabelledDescription, _effect.Option.some)), /*#__PURE__*/_effectLib.MMatch.when(CVTemplatePart.isSeparator, /*#__PURE__*/_effect.Function.constant(/*#__PURE__*/_effect.Option.none())), _effectLib.MMatch.exhaustive)), /*#__PURE__*/_effect.Array.join('.\n'));
46
+ //# sourceMappingURL=TemplateParts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateParts.js","names":["_effectLib","require","_effect","CVTemplatePart","_interopRequireWildcard","CVTemplatePlaceholder","CVTemplateSeparator","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getSyntheticDescription","exports","flow","Array","map","MMatch","make","when","isPlaceholder","label","isSeparator","value","exhaustive","join","getPlaceholderDescription","filterMap","getLabelledDescription","Option","some","Function","constant","none"],"sources":["../../esm/TemplateParts.ts"],"sourcesCont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