@parischap/conversions 0.1.0 → 0.3.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 (125) hide show
  1. package/README.md +50 -49
  2. package/cjs/BigDecimal.js +2 -2
  3. package/cjs/BigInt.js +7 -5
  4. package/cjs/BigInt.js.map +1 -1
  5. package/cjs/DateTime.js +144 -136
  6. package/cjs/DateTime.js.map +1 -1
  7. package/cjs/DateTimeFormat.js +7 -2
  8. package/cjs/DateTimeFormat.js.map +1 -1
  9. package/cjs/DateTimeFormatContext.js +11 -6
  10. package/cjs/DateTimeFormatContext.js.map +1 -1
  11. package/cjs/Email.js +11 -15
  12. package/cjs/Email.js.map +1 -1
  13. package/cjs/Integer.js +33 -23
  14. package/cjs/Integer.js.map +1 -1
  15. package/cjs/NumberBase10Format.js +65 -65
  16. package/cjs/PositiveInteger.js +44 -29
  17. package/cjs/PositiveInteger.js.map +1 -1
  18. package/cjs/PositiveReal.js +34 -24
  19. package/cjs/PositiveReal.js.map +1 -1
  20. package/cjs/Real.js +29 -18
  21. package/cjs/Real.js.map +1 -1
  22. package/cjs/RoundingMode.js +7 -4
  23. package/cjs/RoundingMode.js.map +1 -1
  24. package/cjs/RoundingOption.js +6 -6
  25. package/cjs/RoundingOption.js.map +1 -1
  26. package/cjs/Schema.js +29 -28
  27. package/cjs/Schema.js.map +1 -1
  28. package/cjs/SemVer.js +19 -20
  29. package/cjs/SemVer.js.map +1 -1
  30. package/cjs/Template.js +36 -31
  31. package/cjs/Template.js.map +1 -1
  32. package/cjs/TemplatePart.js +4 -4
  33. package/cjs/TemplateParts.js +3 -2
  34. package/cjs/TemplateParts.js.map +1 -1
  35. package/cjs/TemplatePlaceholder.js +56 -45
  36. package/cjs/TemplatePlaceholder.js.map +1 -1
  37. package/cjs/TemplateSeparator.js +17 -24
  38. package/cjs/TemplateSeparator.js.map +1 -1
  39. package/cjs/internal/Int.js +5 -8
  40. package/cjs/internal/Int.js.map +1 -1
  41. package/cjs/internal/Positive.js +5 -8
  42. package/cjs/internal/Positive.js.map +1 -1
  43. package/dts/BigDecimal.d.ts +2 -2
  44. package/dts/BigDecimal.d.ts.map +1 -1
  45. package/dts/BigInt.d.ts +7 -5
  46. package/dts/BigInt.d.ts.map +1 -1
  47. package/dts/DateTime.d.ts +145 -137
  48. package/dts/DateTime.d.ts.map +1 -1
  49. package/dts/DateTimeFormat.d.ts +7 -2
  50. package/dts/DateTimeFormat.d.ts.map +1 -1
  51. package/dts/DateTimeFormatContext.d.ts +17 -12
  52. package/dts/DateTimeFormatContext.d.ts.map +1 -1
  53. package/dts/Email.d.ts +16 -13
  54. package/dts/Email.d.ts.map +1 -1
  55. package/dts/Integer.d.ts +43 -21
  56. package/dts/Integer.d.ts.map +1 -1
  57. package/dts/NumberBase10Format.d.ts +68 -68
  58. package/dts/PositiveInteger.d.ts +54 -27
  59. package/dts/PositiveInteger.d.ts.map +1 -1
  60. package/dts/PositiveReal.d.ts +44 -22
  61. package/dts/PositiveReal.d.ts.map +1 -1
  62. package/dts/Real.d.ts +39 -16
  63. package/dts/Real.d.ts.map +1 -1
  64. package/dts/RoundingMode.d.ts +6 -3
  65. package/dts/RoundingMode.d.ts.map +1 -1
  66. package/dts/RoundingOption.d.ts +6 -6
  67. package/dts/Schema.d.ts +32 -33
  68. package/dts/Schema.d.ts.map +1 -1
  69. package/dts/SemVer.d.ts +25 -13
  70. package/dts/SemVer.d.ts.map +1 -1
  71. package/dts/Template.d.ts +30 -29
  72. package/dts/Template.d.ts.map +1 -1
  73. package/dts/TemplatePart.d.ts +4 -4
  74. package/dts/TemplateParts.d.ts +4 -3
  75. package/dts/TemplateParts.d.ts.map +1 -1
  76. package/dts/TemplatePlaceholder.d.ts +56 -44
  77. package/dts/TemplatePlaceholder.d.ts.map +1 -1
  78. package/dts/TemplateSeparator.d.ts +9 -51
  79. package/dts/TemplateSeparator.d.ts.map +1 -1
  80. package/dts/internal/Int.d.ts +0 -4
  81. package/dts/internal/Int.d.ts.map +1 -1
  82. package/dts/internal/Positive.d.ts +0 -4
  83. package/dts/internal/Positive.d.ts.map +1 -1
  84. package/esm/BigDecimal.js +2 -2
  85. package/esm/BigInt.js +7 -5
  86. package/esm/BigInt.js.map +1 -1
  87. package/esm/DateTime.js +144 -136
  88. package/esm/DateTime.js.map +1 -1
  89. package/esm/DateTimeFormat.js +7 -2
  90. package/esm/DateTimeFormat.js.map +1 -1
  91. package/esm/DateTimeFormatContext.js +11 -6
  92. package/esm/DateTimeFormatContext.js.map +1 -1
  93. package/esm/Email.js +10 -13
  94. package/esm/Email.js.map +1 -1
  95. package/esm/Integer.js +33 -23
  96. package/esm/Integer.js.map +1 -1
  97. package/esm/NumberBase10Format.js +65 -65
  98. package/esm/PositiveInteger.js +44 -29
  99. package/esm/PositiveInteger.js.map +1 -1
  100. package/esm/PositiveReal.js +34 -24
  101. package/esm/PositiveReal.js.map +1 -1
  102. package/esm/Real.js +29 -18
  103. package/esm/Real.js.map +1 -1
  104. package/esm/RoundingMode.js +6 -3
  105. package/esm/RoundingMode.js.map +1 -1
  106. package/esm/RoundingOption.js +6 -6
  107. package/esm/RoundingOption.js.map +1 -1
  108. package/esm/Schema.js +33 -34
  109. package/esm/Schema.js.map +1 -1
  110. package/esm/SemVer.js +18 -18
  111. package/esm/SemVer.js.map +1 -1
  112. package/esm/Template.js +36 -31
  113. package/esm/Template.js.map +1 -1
  114. package/esm/TemplatePart.js +4 -4
  115. package/esm/TemplateParts.js +3 -2
  116. package/esm/TemplateParts.js.map +1 -1
  117. package/esm/TemplatePlaceholder.js +55 -44
  118. package/esm/TemplatePlaceholder.js.map +1 -1
  119. package/esm/TemplateSeparator.js +16 -24
  120. package/esm/TemplateSeparator.js.map +1 -1
  121. package/esm/internal/Int.js +5 -7
  122. package/esm/internal/Int.js.map +1 -1
  123. package/esm/internal/Positive.js +5 -7
  124. package/esm/internal/Positive.js.map +1 -1
  125. package/package.json +2 -2
@@ -1,6 +1,9 @@
1
1
  /**
2
- * This module implements a finite integer brand (Infinity, NaN or non-null fractional part
3
- * disallowed)
2
+ * This module implements a CVPositiveInteger brand, i.e. a number that represents an integer
3
+ * greater than or equal to 0 (Infinity, NaN disallowed). Can be used to represent an age, a
4
+ * quantity,... See the `Effect` documentation about Branding
5
+ * (https://effect.website/docs/code-style/branded-types/) if you are not familiar with this
6
+ * concept.
4
7
  */
5
8
  import { Brand, Either, flow, Function, Option, Schema } from 'effect';
6
9
  import * as CVInteger from './Integer.js';
@@ -14,151 +17,163 @@ export const moduleTag = '@parischap/conversions/PositiveInteger/';
14
17
  /**
15
18
  * Brand constructor. Should not be used directly
16
19
  *
17
- * @category Constructors
20
+ * @ignore
18
21
  */
19
22
  export const constructor = /*#__PURE__*/Brand.all(CVInteger.constructor, CVPositive.constructor);
20
23
  /**
21
- * Constructs a PositiveInteger from a number without any verifications
24
+ * Constructs a `CVPositiveInteger` from a number without any verifications
22
25
  *
23
26
  * @category Constructors
24
27
  */
25
28
  export const unsafeFromNumber = /*#__PURE__*/Brand.nominal();
26
29
  /**
27
- * Constructs an Option of a PositiveInteger from a number
30
+ * Tries to construct a `CVPositiveInteger` from a number. Returns a `Some` if the conversion can be
31
+ * performed, a `None` otherwise
28
32
  *
29
33
  * @category Constructors
30
34
  */
31
35
  export const fromNumberOption = /*#__PURE__*/constructor.option.bind(constructor);
32
36
  /**
33
- * Constructs an Either of a PositiveInteger from a number
37
+ * Tries to construct a `CVPositiveInteger` from a number. Returns a `Right` if the conversion can
38
+ * be performed, a `Left` otherwise
34
39
  *
35
40
  * @category Constructors
36
41
  */
37
42
  export const fromNumber = /*#__PURE__*/constructor.either.bind(constructor);
38
43
  /**
39
- * Constructs a PositiveInteger from a number or throws
44
+ * Constructs a `CVPositiveInteger` from a number if possible. Throws otherwise
40
45
  *
41
46
  * @category Constructors
42
47
  */
43
48
  export const fromNumberOrThrow = constructor;
44
49
  /**
45
- * Constructs a PositiveInteger from a BigDecimal without any checks
50
+ * Constructs a `CVPositiveInteger` from a `BigDecimal` without any checks
46
51
  *
47
52
  * @category Constructors
48
53
  */
49
54
  export const unsafeFromBigDecimal = CVInteger.unsafeFromBigDecimal;
50
55
  /**
51
- * Constructs an Option of a PositiveInteger from a BigDecimal
56
+ * Tries to construct a `CVPositiveInteger` from a `BigDecimal`. Returns a `Some` if the conversion
57
+ * can be performed, a `None` otherwise
52
58
  *
53
59
  * @category Constructors
54
60
  */
55
61
  export const fromBigDecimalOption = /*#__PURE__*/flow(CVInteger.fromBigDecimalOption, /*#__PURE__*/Option.flatMap(CVPositive.fromNumberOption));
56
62
  /**
57
- * Constructs an Either of a PositiveInteger from a BigDecimal
63
+ * Tries to construct a `CVPositiveInteger` from a `BigDecimal`. Returns a `Right` if the conversion
64
+ * can be performed, a `Left` otherwise
58
65
  *
59
66
  * @category Constructors
60
67
  */
61
68
  export const fromBigDecimal = /*#__PURE__*/flow(CVInteger.fromBigDecimal, /*#__PURE__*/Either.flatMap(CVPositive.fromNumber));
62
69
  /**
63
- * Constructs a PositiveInteger from a BigDecimal or throws
70
+ * Constructs a `CVPositiveInteger` from a `BigDecimal` if possible. Throws otherwise
64
71
  *
65
72
  * @category Constructors
66
73
  */
67
74
  export const fromBigDecimalOrThrow = /*#__PURE__*/flow(CVInteger.fromBigDecimalOrThrow, CVPositive.fromNumberOrThrow);
68
75
  /**
69
- * Constructs a PositiveInteger from a BigInt without any checks
76
+ * Constructs a `CVPositiveInteger` from a `BigInt` without any checks
70
77
  *
71
78
  * @category Constructors
72
79
  */
73
80
  export const unsafeFromBigInt = CVInteger.unsafeFromBigInt;
74
81
  /**
75
- * Constructs an Option of a PositiveInteger from a BigInt
82
+ * Tries to construct a `CVPositiveInteger` from a `BigInt`. Returns a `Some` if the conversion can
83
+ * be performed, a `None` otherwise
76
84
  *
77
85
  * @category Constructors
78
86
  */
79
87
  export const fromBigIntOption = /*#__PURE__*/flow(CVInteger.fromBigIntOption, /*#__PURE__*/Option.flatMap(CVPositive.fromNumberOption));
80
88
  /**
81
- * Constructs an Either of a PositiveInteger from a BigInt
89
+ * Tries to construct a `CVPositiveInteger` from a `BigInt`. Returns a `Right` if the conversion can
90
+ * be performed, a `Left` otherwise
82
91
  *
83
92
  * @category Constructors
84
93
  */
85
94
  export const fromBigInt = /*#__PURE__*/flow(CVInteger.fromBigInt, /*#__PURE__*/Either.flatMap(CVPositive.fromNumber));
86
95
  /**
87
- * Constructs a PositiveInteger from a BigInt or throws
96
+ * Constructs a `CVPositiveInteger` from a `BigInt` if possible. Throws otherwise
88
97
  *
89
98
  * @category Constructors
90
99
  */
91
100
  export const fromBigIntOrThrow = /*#__PURE__*/flow(CVInteger.fromBigIntOrThrow, CVPositive.fromNumberOrThrow);
92
101
  /**
93
- * Constructs a PositiveInteger from a Real without any checks
102
+ * Constructs a `CVPositiveInteger` from a `CVReal` without any checks
94
103
  *
95
104
  * @category Constructors
96
105
  */
97
106
  export const unsafeFromReal = Function.identity;
98
107
  /**
99
- * Constructs an Option of a PositiveInteger from a Real
108
+ * Tries to construct a `CVPositiveInteger` from a `CVReal`. Returns a `Some` if the conversion can
109
+ * be performed, a `None` otherwise
100
110
  *
101
111
  * @category Constructors
102
112
  */
103
113
  export const fromRealOption = /*#__PURE__*/flow(CVInteger.fromRealOption, /*#__PURE__*/Option.flatMap(CVPositive.fromNumberOption));
104
114
  /**
105
- * Constructs an Either of a PositiveInteger from a Real
115
+ * Tries to construct a `CVPositiveInteger` from a `CVReal`. Returns a `Right` if the conversion can
116
+ * be performed, a `Left` otherwise
106
117
  *
107
118
  * @category Constructors
108
119
  */
109
120
  export const fromReal = /*#__PURE__*/flow(CVInteger.fromReal, /*#__PURE__*/Either.flatMap(CVPositive.fromNumber));
110
121
  /**
111
- * Constructs a PositiveInteger from a Real or throws
122
+ * Constructs a `CVPositiveInteger` from a `CVReal` if possible. Throws otherwise
112
123
  *
113
124
  * @category Constructors
114
125
  */
115
126
  export const fromRealOrThrow = /*#__PURE__*/flow(CVInteger.fromRealOrThrow, CVPositive.fromNumberOrThrow);
116
127
  /**
117
- * Constructs an Option of a PositiveInteger from an Integer
128
+ * Tries to construct a `CVPositiveInteger` from a `CVInteger`. Returns a `Some` if the conversion
129
+ * can be performed, a `None` otherwise
118
130
  *
119
131
  * @category Constructors
120
132
  */
121
133
  export const fromIntegerOption = /*#__PURE__*/flow(CVPositive.fromNumberOption);
122
134
  /**
123
- * Constructs an Either of a PositiveInteger from an Integer
135
+ * Tries to construct a `CVPositiveInteger` from a `CVInteger`. Returns a `Right` if the conversion
136
+ * can be performed, a `Left` otherwise
124
137
  *
125
138
  * @category Constructors
126
139
  */
127
140
  export const fromInteger = CVPositive.fromNumber;
128
141
  /**
129
- * Constructs a PositiveInteger from an Integer or throws
142
+ * Constructs a `CVPositiveInteger` from a `CVInteger` if possible. Throws otherwise
130
143
  *
131
144
  * @category Constructors
132
145
  */
133
146
  export const fromIntegerOrThrow = /*#__PURE__*/flow(CVPositive.fromNumberOrThrow);
134
147
  /**
135
- * Constructs an Option of a PositiveInteger from a PositiveReal
148
+ * Tries to construct a `CVPositiveInteger` from a `CVPositiveReal`. Returns a `Some` if the
149
+ * conversion can be performed, a `None` otherwise
136
150
  *
137
151
  * @category Constructors
138
152
  */
139
153
  export const fromPositiveRealOption = /*#__PURE__*/flow(CVInteger.fromRealOption);
140
154
  /**
141
- * Constructs an Either of a PositiveInteger from a PositiveReal
155
+ * Tries to construct a `CVPositiveInteger` from a `CVPositiveReal`. Returns a `Right` if the
156
+ * conversion can be performed, a `Left` otherwise
142
157
  *
143
158
  * @category Constructors
144
159
  */
145
160
  export const fromPositiveReal = CVInteger.fromReal;
146
161
  /**
147
- * Constructs a PositiveInteger from a PositiveReal or throws
162
+ * Constructs a `CVPositiveInteger` from a `CVPositiveReal` if possible. Throws otherwise
148
163
  *
149
164
  * @category Constructors
150
165
  */
151
166
  export const fromPositiveRealOrThrow = /*#__PURE__*/flow(CVInteger.fromRealOrThrow);
152
167
  /**
153
- * A Schema that transforms a number into a CVPositiveInteger.Type
168
+ * A `Schema` that transforms a number into a `CVPositiveInteger`
154
169
  *
155
- * @internal
170
+ * @ignore
156
171
  */
157
172
  export const SchemaFromNumber = /*#__PURE__*/Schema.Number.pipe(/*#__PURE__*/Schema.fromBrand(constructor));
158
173
  /**
159
- * A Schema that represents a CVPositiveInteger.Type
174
+ * A Schema that represents a `CVPositiveInteger`
160
175
  *
161
- * @internal
176
+ * @ignore
162
177
  */
163
178
  export const SchemaFromSelf = /*#__PURE__*/Schema.typeSchema(SchemaFromNumber);
164
179
  //# sourceMappingURL=PositiveInteger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PositiveInteger.js","names":["Brand","Either","flow","Function","Option","Schema","CVInteger","CVPositive","moduleTag","constructor","all","unsafeFromNumber","nominal","fromNumberOption","option","bind","fromNumber","either","fromNumberOrThrow","unsafeFromBigDecimal","fromBigDecimalOption","flatMap","fromBigDecimal","fromBigDecimalOrThrow","unsafeFromBigInt","fromBigIntOption","fromBigInt","fromBigIntOrThrow","unsafeFromReal","identity","fromRealOption","fromReal","fromRealOrThrow","fromIntegerOption","fromInteger","fromIntegerOrThrow","fromPositiveRealOption","fromPositiveReal","fromPositiveRealOrThrow","SchemaFromNumber","Number","pipe","fromBrand","SchemaFromSelf","typeSchema"],"sources":["../../esm/PositiveInteger.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAMA,SAAqBA,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAClF,OAAO,KAAKC,SAAS,MAAM,cAAc;AACzC,OAAO,KAAKC,UAAU,MAAM,wBAAwB;AAIpD;;;;;AAKA,OAAO,MAAMC,SAAS,GAAG,yCAAyC;AAElE;;;;;AAKA,OAAO,MAAMC,WAAW,gBAAGT,KAAK,CAACU,GAAG,CAACJ,SAAS,CAACG,WAAW,EAAEF,UAAU,CAACE,WAAW,CAAC;AASnF;;;;;AAKA,OAAO,MAAME,gBAAgB,gBAAGX,KAAK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.js","names":["Brand","Either","flow","Function","Option","Schema","CVInteger","CVPositive","moduleTag","constructor","all","unsafeFromNumber","nominal","fromNumberOption","option","bind","fromNumber","either","fromNumberOrThrow","unsafeFromBigDecimal","fromBigDecimalOption","flatMap","fromBigDecimal","fromBigDecimalOrThrow","unsafeFromBigInt","fromBigIntOption","fromBigInt","fromBigIntOrThrow","unsafeFromReal","identity","fromRealOption","fromReal","fromRealOrThrow","fromIntegerOption","fromInteger","fromIntegerOrThrow","fromPositiveRealOption","fromPositiveReal","fromPositiveRealOrThrow","SchemaFromNumber","Number","pipe","fromBrand","SchemaFromSelf","typeSchema"],"sources":["../../esm/PositiveInteger.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;AASA,SAAqBA,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAClF,OAAO,KAAKC,SAAS,MAAM,cAAc;AACzC,OAAO,KAAKC,UAAU,MAAM,wBAAwB;AAIpD;;;;;AAKA,OAAO,MAAMC,SAAS,GAAG,yCAAyC;AAElE;;;;;AAKA,OAAO,MAAMC,WAAW,gBAAGT,KAAK,CAACU,GAAG,CAACJ,SAAS,CAACG,WAAW,EAAEF,UAAU,CAACE,WAAW,CAAC;AASnF;;;;;AAKA,OAAO,MAAME,gBAAgB,gBAAGX,KAAK,CAACY,OAAO,EAAQ;AAErD;;;;;;AAMA,OAAO,MAAMC,gBAAgB,gBAGzBJ,WAAW,CAACK,MAAM,CAACC,IAAI,CAACN,WAAW,CAAC;AAExC;;;;;;AAMA,OAAO,MAAMO,UAAU,gBAGnBP,WAAW,CAACQ,MAAM,CAACF,IAAI,CAACN,WAAW,CAAC;AAExC;;;;;AAKA,OAAO,MAAMS,iBAAiB,GAAwCT,WAAW;AAEjF;;;;;AAKA,OAAO,MAAMU,oBAAoB,GAChCb,SAAS,CAACa,oBAA6B;AAExC;;;;;;AAMA,OAAO,MAAMC,oBAAoB,gBAG7BlB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A,OAAO,MAAMgB,eAAe,gBAA6C9B,IAAI,CAC5EI,SAAS,CAAC0B,eAAe,EACzBzB,UAAU,CAACW,iBAAiB,CACnB;AAEV;;;;;;AAMA,OAAO,MAAMe,iBAAiB,gBAA+D/B,IAAI,CAChGK,UAAU,CAACM,gBAAgB,CAClB;AAEV;;;;;;AAMA,OAAO,MAAMqB,WAAW,GAGpB3B,UAAU,CAACS,UAAmB;AAElC;;;;;AAKA,OAAO,MAAMmB,kBAAkB,gBAAgDjC,IAAI,CAClFK,UAAU,CAACW,iBAAiB,CACnB;AAEV;;;;;;AAMA,OAAO,MAAMkB,sBAAsB,gBAG/BlC,IAAI,CAACI,SAAS,CAACwB,cAAc,CAAU;AAE3C;;;;;;AAMA,OAAO,MAAMO,gBAAgB,GAGzB/B,SAAS,CAACyB,QAAiB;AAE/B;;;;;AAKA,OAAO,MAAMO,uBAAuB,gBAAqDpC,IAAI,CAC5FI,SAAS,CAAC0B,eAAe,CAChB;AAEV;;;;;AAKA,OAAO,MAAMO,gBAAgB,gBAAgClC,MAAM,CAACmC,MAAM,CAACC,IAAI,cAC9EpC,MAAM,CAACqC,SAAS,CAACjC,WAAW,CAAC,CAC7B;AAED;;;;;AAKA,OAAO,MAAMkC,cAAc,gBAAwBtC,MAAM,CAACuC,UAAU,CAACL,gBAAgB,CAAC","ignoreList":[]}
@@ -1,6 +1,8 @@
1
1
  /**
2
- * This module implements a positive finite number brand (NaN, Infinity and negative numbers
3
- * disallowed). Useful for a price, a physical quantity...
2
+ * This module implements a CVPositiveReal brand, i.e. a number greater than or equal to 0
3
+ * (Infinity, NaN disallowed). Can be used to represent a price, a speed,... See the `Effect`
4
+ * documentation about Branding (https://effect.website/docs/code-style/branded-types/) if you are
5
+ * not familiar with this concept.
4
6
  */
5
7
  import { MNumber } from '@parischap/effect-lib';
6
8
  import { Brand, Either, flow, Function, Option, Schema } from 'effect';
@@ -15,121 +17,129 @@ export const moduleTag = '@parischap/conversions/PositiveReal/';
15
17
  /**
16
18
  * Brand constructor. Should not be used directly
17
19
  *
18
- * @category Constructors
20
+ * @ignore
19
21
  */
20
22
  export const constructor = /*#__PURE__*/Brand.all(CVReal.constructor, CVPositive.constructor);
21
23
  /**
22
- * Constructs a PositiveReal from a number without any verifications
24
+ * Constructs a `CVPositiveReal` from a number without any verifications
23
25
  *
24
26
  * @category Constructors
25
27
  */
26
28
  export const unsafeFromNumber = /*#__PURE__*/Brand.nominal();
27
29
  /**
28
- * Constructs an Option of a PositiveReal from a number
30
+ * Tries to construct a `CVPositiveReal` from a number. Returns a `Some` if the conversion can be
31
+ * performed, a `None` otherwise
29
32
  *
30
33
  * @category Constructors
31
34
  */
32
35
  export const fromNumberOption = /*#__PURE__*/constructor.option.bind(constructor);
33
36
  /**
34
- * Constructs an Either of a PositiveReal from a number
37
+ * Tries to construct a `CVPositiveReal` from a number. Returns a `Right` if the conversion can be
38
+ * performed, a `Left` otherwise
35
39
  *
36
40
  * @category Constructors
37
41
  */
38
42
  export const fromNumber = /*#__PURE__*/constructor.either.bind(constructor);
39
43
  /**
40
- * Constructs a PositiveReal from a number or throws
44
+ * Constructs a `CVPositiveReal` from a number if possible. Throws otherwise
41
45
  *
42
46
  * @category Constructors
43
47
  */
44
48
  export const fromNumberOrThrow = constructor;
45
49
  /**
46
- * Constructs a PositiveReal from a BigDecimal without any checks
50
+ * Constructs a `CVPositiveReal` from a `BigDecimal` without any checks
47
51
  *
48
52
  * @category Constructors
49
53
  */
50
54
  export const unsafeFromBigDecimal = MNumber.unsafeFromBigDecimal;
51
55
  /**
52
- * Constructs an Option of a PositiveReal from a BigDecimal
56
+ * Tries to construct a `CVPositiveReal` from a `BigDecimal`. Returns a `Some` if the conversion can
57
+ * be performed, a `None` otherwise
53
58
  *
54
59
  * @category Constructors
55
60
  */
56
61
  export const fromBigDecimalOption = /*#__PURE__*/flow(CVReal.fromBigDecimalOption, /*#__PURE__*/Option.flatMap(CVPositive.fromNumberOption));
57
62
  /**
58
- * Constructs an Either of a PositiveReal from a BigDecimal
63
+ * Tries to construct a `CVPositiveReal` from a `BigDecimal`. Returns a `Right` if the conversion
64
+ * can be performed, a `Left` otherwise
59
65
  *
60
66
  * @category Constructors
61
67
  */
62
68
  export const fromBigDecimal = /*#__PURE__*/flow(CVReal.fromBigDecimal, /*#__PURE__*/Either.flatMap(CVPositive.fromNumber));
63
69
  /**
64
- * Constructs a PositiveReal from a BigDecimal or throws
70
+ * Constructs a `CVPositiveReal` from a `BigDecimal` if possible. Throws otherwise
65
71
  *
66
72
  * @category Constructors
67
73
  */
68
74
  export const fromBigDecimalOrThrow = /*#__PURE__*/flow(CVReal.fromBigDecimalOrThrow, CVPositive.fromNumberOrThrow);
69
75
  /**
70
- * Constructs a PositiveReal from a BigInt without any checks
76
+ * Constructs a `CVPositiveReal` from a `BigInt` without any checks
71
77
  *
72
78
  * @category Constructors
73
79
  */
74
80
  export const unsafeFromBigInt = MNumber.unsafeFromBigInt;
75
81
  /**
76
- * Constructs an Option of a PositiveReal from a BigInt
82
+ * Tries to construct a `CVPositiveReal` from a `BigInt`. Returns a `Some` if the conversion can be
83
+ * performed, a `None` otherwise
77
84
  *
78
85
  * @category Constructors
79
86
  */
80
87
  export const fromBigIntOption = /*#__PURE__*/flow(CVReal.fromBigIntOption, /*#__PURE__*/Option.flatMap(CVPositive.fromNumberOption));
81
88
  /**
82
- * Constructs an Either of a PositiveReal from a BigInt
89
+ * Tries to construct a `CVPositiveReal` from a `BigInt`. Returns a `Right` if the conversion can be
90
+ * performed, a `Left` otherwise
83
91
  *
84
92
  * @category Constructors
85
93
  */
86
94
  export const fromBigInt = /*#__PURE__*/flow(CVReal.fromBigInt, /*#__PURE__*/Either.flatMap(CVPositive.fromNumber));
87
95
  /**
88
- * Constructs a PositiveReal from a BigInt or throws
96
+ * Constructs a `CVPositiveReal` from a `BigInt` if possible. Throws otherwise
89
97
  *
90
98
  * @category Constructors
91
99
  */
92
100
  export const fromBigIntOrThrow = /*#__PURE__*/flow(CVReal.fromBigIntOrThrow, CVPositive.fromNumberOrThrow);
93
101
  /**
94
- * Constructs a PositiveReal from a Real without any checks
102
+ * Constructs a `CVPositiveReal` from a `CVReal` without any checks
95
103
  *
96
104
  * @category Constructors
97
105
  */
98
106
  export const unsafeFromReal = Function.identity;
99
107
  /**
100
- * Constructs an Option of a PositiveReal from a Real
108
+ * Tries to construct a `CVPositiveReal` from a `CVReal`. Returns a `Some` if the conversion can be
109
+ * performed, a `None` otherwise
101
110
  *
102
111
  * @category Constructors
103
112
  */
104
113
  export const fromRealOption = CVPositive.fromNumberOption;
105
114
  /**
106
- * Constructs an Either of a PositiveReal from a Real
115
+ * Tries to construct a `CVPositiveReal` from a `CVReal`. Returns a `Right` if the conversion can be
116
+ * performed, a `Left` otherwise
107
117
  *
108
118
  * @category Constructors
109
119
  */
110
120
  export const fromReal = CVPositive.fromNumber;
111
121
  /**
112
- * Constructs a PositiveReal from a Real or throws
122
+ * Constructs a `CVPositiveReal` from a `CVReal` if possible. Throws otherwise
113
123
  *
114
124
  * @category Constructors
115
125
  */
116
126
  export const fromRealOrThrow = CVPositive.fromNumberOrThrow;
117
127
  /**
118
- * Constructs a PositiveReal from a PositiveInteger
128
+ * Constructs a `CVPositiveReal` from a `CVPositiveInteger`
119
129
  *
120
130
  * @category Constructors
121
131
  */
122
132
  export const fromPositiveInteger = Function.identity;
123
133
  /**
124
- * A Schema that transforms a number into a CVPositiveReal.Type
134
+ * A `Schema` that transforms a number into a `CVPositiveReal`
125
135
  *
126
- * @internal
136
+ * @ignore
127
137
  */
128
138
  export const SchemaFromNumber = /*#__PURE__*/Schema.Number.pipe(/*#__PURE__*/Schema.fromBrand(constructor));
129
139
  /**
130
- * A Schema that represents a CVPositiveReal.Type
140
+ * A `Schema` that represents a `CVPositiveReal`
131
141
  *
132
- * @internal
142
+ * @ignore
133
143
  */
134
144
  export const SchemaFromSelf = /*#__PURE__*/Schema.typeSchema(SchemaFromNumber);
135
145
  //# sourceMappingURL=PositiveReal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PositiveReal.js","names":["MNumber","Brand","Either","flow","Function","Option","Schema","CVPositive","CVReal","moduleTag","constructor","all","unsafeFromNumber","nominal","fromNumberOption","option","bind","fromNumber","either","fromNumberOrThrow","unsafeFromBigDecimal","fromBigDecimalOption","flatMap","fromBigDecimal","fromBigDecimalOrThrow","unsafeFromBigInt","fromBigIntOption","fromBigInt","fromBigIntOrThrow","unsafeFromReal","identity","fromRealOption","fromReal","fromRealOrThrow","fromPositiveInteger","SchemaFromNumber","Number","pipe","fromBrand","SchemaFromSelf","typeSchema"],"sources":["../../esm/PositiveReal.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAKA,SAASA,OAAO,QAAgB,uBAAuB;AACvD,SAAqBC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAClF,OAAO,KAAKC,UAAU,MAAM,wBAAwB;AAEpD,OAAO,KAAKC,MAAM,MAAM,WAAW;AAEnC;;;;;AAKA,OAAO,MAAMC,SAAS,GAAG,sCAAsC;AAE/D;;;;;AAKA,OAAO,MAAMC,WAAW,gBAAGT,KAAK,CAACU,GAAG,CAACH,MAAM,CAACE,WAAW,EAAEH,UAAU,CAACG,WAAW,CAAC;AAShF;;;;;AAKA,OAAO,MAAME,gBAAgB,gBAAGX,KAAK,CAACY,OAAO,EAAQ;AAErD;;;;;AAKA,OAAO,MAAMC,gBAAgB,gBAGzBJ,WAAW,CAACK,MAAM,CAACC,IAAI,CAACN,WAAW,CAAC;AAExC;;;;;AAKA,OAAO,MAAMO,UAAU,gBAGnBP,WAAW,CAACQ,MAAM,CAACF,IAAI,CAACN,WAAW,CAAC;AAExC;;;;;AAKA,OAAO,MAAMS,iBAAiB,GAAwCT,WAAW;AAEjF;;;;;AAKA,OAAO,MAAMU,oBAAoB,GAChCpB,OAAO,CAACoB,oBAA6B;AAEtC;;;;;AAKA,OAAO,MAAMC,oBAAoB,gBAG7B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AAgC7B,MAAM,CAAC8B,MAAM,CAACC,IAAI,cAC9E/B,MAAM,CAACgC,SAAS,CAAC5B,WAAW,CAAC,CAC7B;AAED;;;;;AAKA,OAAO,MAAM6B,cAAc,gBAAwBjC,MAAM,CAACkC,UAAU,CAACL,gBAAgB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"PositiveReal.js","names":["MNumber","Brand","Either","flow","Function","Option","Schema","CVPositive","CVReal","moduleTag","constructor","all","unsafeFromNumber","nominal","fromNumberOption","option","bind","fromNumber","either","fromNumberOrThrow","unsafeFromBigDecimal","fromBigDecimalOption","flatMap","fromBigDecimal","fromBigDecimalOrThrow","unsafeFromBigInt","fromBigIntOption","fromBigInt","fromBigIntOrThrow","unsafeFromReal","identity","fromRealOption","fromReal","fromRealOrThrow","fromPositiveInteger","SchemaFromNumber","Number","pipe","fromBrand","SchemaFromSelf","typeSchema"],"sources":["../../esm/PositiveReal.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;AAOA,SAASA,OAAO,QAAgB,uBAAuB;AACvD,SAAqBC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAClF,OAAO,KAAKC,UAAU,MAAM,wBAAwB;AAEpD,OAAO,KAAKC,MAAM,MAAM,WAAW;AAEnC;;;;;AAKA,OAAO,MAAMC,SAAS,GAAG,sCAAsC;AAE/D;;;;;AAKA,OAAO,MAAMC,WAAW,gBAAGT,KAAK,CAACU,GAAG,CAACH,MAAM,CAACE,WAAW,EAAEH,UAAU,CAACG,WAAW,CAAC;AAShF;;;;;AAKA,OAAO,MAAME,gBAAgB,gBAAGX,KAAK,CAACY,OAAO,EAAQ;AAErD;;;;;;AAMA,OAAO,MAAMC,gBAAgB,gBAGzBJ,WAAW,CAACK,MAAM,CAACC,IAAI,CAACN,WAAW,CAAC;AAExC;;;;;;AAMA,OAAO,MAAMO,UAAU,gBAGnBP,WAAW,CAACQ,MAAM,CA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zB,UAAU,CAACU,UAAmB;AAElC;;;;;AAKA,OAAO,MAAMgB,eAAe,GAC3B1B,UAAU,CAACY,iBAA0B;AAEtC;;;;;AAKA,OAAO,MAAMe,mBAAmB,GAC/B9B,QAAQ,CAAC0B,QAAiB;AAE3B;;;;;AAKA,OAAO,MAAMK,gBAAgB,gBAAgC7B,MAAM,CAAC8B,MAAM,CAACC,IAAI,cAC9E/B,MAAM,CAACgC,SAAS,CAAC5B,WAAW,CAAC,CAC7B;AAED;;;;;AAKA,OAAO,MAAM6B,cAAc,gBAAwBjC,MAAM,CAACkC,UAAU,CAACL,gBAAgB,CAAC","ignoreList":[]}
package/esm/Real.js CHANGED
@@ -1,4 +1,9 @@
1
- /** This module implements a finite number brand (Infinity or Nan disallowed) */
1
+ /**
2
+ * This module implements a CVReal brand, i.e. a number that disallows Infinity and NaN. Can be used
3
+ * to represent a temperature, a height from sea-level,... See the `Effect` documentation about
4
+ * Branding (https://effect.website/docs/code-style/branded-types/) if you are not familiar with
5
+ * this concept.
6
+ */
2
7
  import { MNumber, MString } from '@parischap/effect-lib';
3
8
  import { Brand, flow, Schema } from 'effect';
4
9
  /**
@@ -16,91 +21,97 @@ export const TypeId = /*#__PURE__*/Symbol.for(moduleTag);
16
21
  /**
17
22
  * Brand constructor. Should not be used directly
18
23
  *
19
- * @category Constructors
24
+ * @ignore
20
25
  */
21
26
  export const constructor = /*#__PURE__*/Brand.refined(MNumber.isFinite, /*#__PURE__*/flow(/*#__PURE__*/MString.fromNumber(10), /*#__PURE__*/MString.prepend("'"), /*#__PURE__*/MString.append("' does not represent a finite number"), Brand.error));
22
27
  /**
23
- * Constructs a Real from a number without any verifications
28
+ * Constructs a `CVReal` from a number without any verifications
24
29
  *
25
30
  * @category Constructors
26
31
  */
27
32
  export const unsafeFromNumber = /*#__PURE__*/Brand.nominal();
28
33
  /**
29
- * Constructs an Option of a Real from a number
34
+ * Tries to construct a `CVReal` from a number. Returns a `Some` if the conversion can be performed,
35
+ * a `None` otherwise
30
36
  *
31
37
  * @category Constructors
32
38
  */
33
39
  export const fromNumberOption = /*#__PURE__*/constructor.option.bind(constructor);
34
40
  /**
35
- * Constructs an Either of a Real from a number
41
+ * Tries to construct a `CVReal` from a number. Returns a `Right` if the conversion can be
42
+ * performed, a `Left` otherwise
36
43
  *
37
44
  * @category Constructors
38
45
  */
39
46
  export const fromNumber = /*#__PURE__*/constructor.either.bind(constructor);
40
47
  /**
41
- * Constructs a Real from a number or throws
48
+ * Constructs a `CVReal` from a number if possible. Throws otherwise
42
49
  *
43
50
  * @category Constructors
44
51
  */
45
52
  export const fromNumberOrThrow = constructor;
46
53
  /**
47
- * Constructs a Real from a BigDecimal without any checks
54
+ * Constructs a `CVReal` from a `BigDecimal` without any checks
48
55
  *
49
56
  * @category Constructors
50
57
  */
51
58
  export const unsafeFromBigDecimal = MNumber.unsafeFromBigDecimal;
52
59
  /**
53
- * Constructs an Option of a Real from a BigDecimal.
60
+ * Tries to construct a `CVReal` from a `BigDecimal`. Returns a `Some` if the conversion can be
61
+ * performed, a `None` otherwise
54
62
  *
55
63
  * @category Constructors
56
64
  */
57
65
  export const fromBigDecimalOption = MNumber.fromBigDecimalOption;
58
66
  /**
59
- * Constructs an Either of a Real from a BigDecimal.
67
+ * Tries to construct a `CVReal` from a `BigDecimal`. Returns a `Right` if the conversion can be
68
+ * performed, a `Left` otherwise
60
69
  *
61
70
  * @category Constructors
62
71
  */
63
72
  export const fromBigDecimal = MNumber.fromBigDecimal;
64
73
  /**
65
- * Constructs a Real from a BigDecimal or throws
74
+ * Constructs a `CVReal` from a `BigDecimal` if possible. Throws otherwise
66
75
  *
67
76
  * @category Constructors
68
77
  */
69
78
  export const fromBigDecimalOrThrow = MNumber.fromBigDecimalOrThrow;
70
79
  /**
71
- * Constructs a Real from a BigInt without any checks
80
+ * Constructs a `CVReal` from a `BigInt` without any checks
72
81
  *
73
82
  * @category Constructors
74
83
  */
75
84
  export const unsafeFromBigInt = MNumber.unsafeFromBigInt;
76
85
  /**
77
- * Constructs an Option of a Real from a BigInt.
86
+ * Tries to construct a `CVReal` from a `BigInt`. Returns a `Some` if the conversion can be
87
+ * performed, a `None` otherwise
78
88
  *
79
89
  * @category Constructors
80
90
  */
81
91
  export const fromBigIntOption = MNumber.fromBigIntOption;
82
92
  /**
83
- * Constructs an Either of a Real from a BigInt.
93
+ * Tries to construct a `CVReal` from a `BigInt`. Returns a `Right` if the conversion can be
94
+ * performed, a `Left` otherwise
84
95
  *
85
96
  * @category Constructors
86
97
  */
87
98
  export const fromBigInt = MNumber.fromBigInt;
88
99
  /**
89
- * Constructs a Real from a BigInt or throws
100
+ * Constructs a `CVReal` from a `BigInt` if possible. Throws otherwise
90
101
  *
91
102
  * @category Constructors
92
103
  */
93
104
  export const fromBigIntOrThrow = MNumber.fromBigIntOrThrow;
94
105
  /**
95
- * A Schema that transforms a number into an CVReal.Type
106
+ * A `Schema` that transforms a number into a `CVReal`
96
107
  *
97
- * @internal
108
+ * @ignore
98
109
  */
99
110
  export const SchemaFromNumber = /*#__PURE__*/Schema.Number.pipe(/*#__PURE__*/Schema.fromBrand(constructor));
100
111
  /**
101
- * A Schema that represents a CVReal.Type
112
+ * A `Schema` that represents a `CVReal`
102
113
  *
103
- * @internal
114
+ * @ignore
104
115
  */
105
116
  export const SchemaFromSelf = /*#__PURE__*/Schema.typeSchema(SchemaFromNumber);
106
117
  //# sourceMappingURL=Real.js.map
package/esm/Real.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Real.js","names":["MNumber","MString","Brand","flow","Schema","moduleTag","TypeId","Symbol","for","constructor","refined","isFinite","fromNumber","prepend","append","error","unsafeFromNumber","nominal","fromNumberOption","option","bind","either","fromNumberOrThrow","unsafeFromBigDecimal","fromBigDecimalOption","fromBigDecimal","fromBigDecimalOrThrow","unsafeFromBigInt","fromBigIntOption","fromBigInt","fromBigIntOrThrow","SchemaFromNumber","Number","pipe","fromBrand","SchemaFromSelf","typeSchema"],"sources":["../../esm/Real.ts"],"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MC,gBAAgB,GAGzB5B,OAAO,CAAC4B,gBAAyB;AAErC;;;;;AAKA,OAAO,MAAMC,UAAU,GAGnB7B,OAAO,CAAC6B,UAAmB;AAE/B;;;;;AAKA,OAAO,MAAMC,iBAAiB,GAC7B9B,OAAO,CAAC8B,iBAA0B;AAEnC;;;;;AAKA,OAAO,MAAMC,gBAAgB,gBAAgC3B,MAAM,CAAC4B,MAAM,CAACC,IAAI,cAC9E7B,MAAM,CAAC8B,SAAS,CAACzB,WAAW,CAAC,CAC7B;AAED;;;;;AAKA,OAAO,MAAM0B,cAAc,gBAAwB/B,MAAM,CAACgC,UAAU,CAACL,gBAAgB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Real.js","names":["MNumber","MString","Brand","flow","Schema","moduleTag","TypeId","Symbol","for","constructor","refined","isFinite","fromNumber","prepend","append","error","unsafeFromNumber","nominal","fromNumberOption","option","bind","either","fromNumberOrThrow","unsafeFromBigDecimal","fromBigDecimalOption","fromBigDecimal","fromBigDecimalOrThrow","unsafeFromBigInt","fromBigIntOption","fromBigInt","fromBigIntOrThrow","SchemaFromNumber","Number","pipe","fromBrand","SchemaFromSelf","typeSchema"],"sources":["../../esm/Real.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;AAOA,SAASA,OAAO,EAAEC,OAAO,QAAgB,uBAAuB;AAChE,SAAqBC,KAAK,EAAUC,IAAI,EAAUC,MAAM,QAAQ,QAAQ;AAExE;;;;;AAKA,OAAO,MAAMC,SAAS,GAAG,8BAA8B;AAEvD;;;;;AAKA,OAAO,MAAMC,MAAM,gBAAkBC,MAAM,CAACC,GAAG,CAACH,SAAS,CAAY;AAUrE;;;;;AAKA,OAAO,MAAMI,WAAW,gBAAGP,KAAK,CAACQ,OAAO,CACvCV,OAAO,CAACW,QAAQ,eAChBR,IAAI,cACHF,OAAO,CAACW,UAAU,CAAC,EAAE,CAAC,eACtBX,OAAO,CAACY,OAAO,CAAC,GAAG,CAAC,eACpBZ,OAAO,CAACa,MA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ormat) */
1
+ /**
2
+ * This module defines the list of available rounding modes (see Intl.NumberFormat) that can be used
3
+ * by a `CVRoundingOption` (see RoundingOption.ts)
4
+ */
2
5
  import { MMatch } from '@parischap/effect-lib';
3
6
  import { flow, Function, Struct } from 'effect';
4
7
  /**
5
- * Possible rounding modes
8
+ * Type that represents the possible rounding modes
6
9
  *
7
10
  * @category Models
8
11
  */
@@ -54,7 +57,7 @@ export var Type;
54
57
  *
55
58
  * @category Destructors
56
59
  */
57
- export const toName = /*#__PURE__*/flow(MMatch.make, /*#__PURE__*/flow(/*#__PURE__*/MMatch.whenIs(Type.Ceil, /*#__PURE__*/Function.constant('Ceil')), /*#__PURE__*/MMatch.whenIs(Type.Floor, /*#__PURE__*/Function.constant('Floor')), /*#__PURE__*/MMatch.whenIs(Type.Expand, /*#__PURE__*/Function.constant('Expand')), /*#__PURE__*/MMatch.whenIs(Type.Trunc, /*#__PURE__*/Function.constant('Trunc')), /*#__PURE__*/MMatch.whenIs(Type.HalfCeil, /*#__PURE__*/Function.constant('HalfCeil')), /*#__PURE__*/MMatch.whenIs(Type.HalfFloor, /*#__PURE__*/Function.constant('HalfFloor')), /*#__PURE__*/MMatch.whenIs(Type.HalfExpand, /*#__PURE__*/Function.constant('HalfExpand')), /*#__PURE__*/MMatch.whenIs(Type.HalfTrunc, /*#__PURE__*/Function.constant('HalfTrunc')), /*#__PURE__*/MMatch.whenIs(Type.HalfEven, /*#__PURE__*/Function.constant('HalfEven'))), MMatch.exhaustive);
60
+ export const getName = /*#__PURE__*/flow(MMatch.make, /*#__PURE__*/flow(/*#__PURE__*/MMatch.whenIs(Type.Ceil, /*#__PURE__*/Function.constant('Ceil')), /*#__PURE__*/MMatch.whenIs(Type.Floor, /*#__PURE__*/Function.constant('Floor')), /*#__PURE__*/MMatch.whenIs(Type.Expand, /*#__PURE__*/Function.constant('Expand')), /*#__PURE__*/MMatch.whenIs(Type.Trunc, /*#__PURE__*/Function.constant('Trunc')), /*#__PURE__*/MMatch.whenIs(Type.HalfCeil, /*#__PURE__*/Function.constant('HalfCeil')), /*#__PURE__*/MMatch.whenIs(Type.HalfFloor, /*#__PURE__*/Function.constant('HalfFloor')), /*#__PURE__*/MMatch.whenIs(Type.HalfExpand, /*#__PURE__*/Function.constant('HalfExpand')), /*#__PURE__*/MMatch.whenIs(Type.HalfTrunc, /*#__PURE__*/Function.constant('HalfTrunc')), /*#__PURE__*/MMatch.whenIs(Type.HalfEven, /*#__PURE__*/Function.constant('HalfEven'))), MMatch.exhaustive);
58
61
  /**
59
62
  * Builds a `Correcter` implementing `self`
60
63
  *
@@ -1 +1 @@
1
- {"version":3,"file":"RoundingMode.js","names":["MMatch","flow","Function","Struct","Type","toName","make","whenIs","Ceil","constant","Floor","Expand","Trunc","HalfCeil","HalfFloor","HalfExpand","HalfTrunc","HalfEven","exhaustive","toCorrecter","firstFollowingDigit","get","Math","sign","isEven"],"sources":["../../esm/RoundingMode.ts"],"sourcesContent":[null],"mappings":"AAAA;AAEA,SAASA,MAAM,QAAgB,uBAAuB;AACtD,SAASC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,QAAQ;AAE/C;;;;;AAKA,WAAYC,IAyCX;AAzCD,WAAYA,IAAI;EACf;EACAA,IAAA,CAAAA,IAAA,sBAAQ;EACR;EACAA,IAAA,CAAAA,IAAA,wBAAS;EACT;;;;EAIAA,IAAA,CAAAA,IAAA,0BAAU;EACV;;;;EAIAA,IAAA,CAAAA,IAAA,wBAAS;EACT;;;;EAIAA,IAAA,CAAAA,IAAA,8BAAY;EACZ;;;;EAIAA,IAAA,CAAAA,IAAA,gCAAa;EACb;;;;EAIAA,IAAA,CAAAA,IAAA,kCAAc;EACd;;;;EAIAA,IAAA,CAAAA,IAAA,gCAAa;EACb;;;;;EAKAA,IAAA,CAAAA,IAAA,8BAAY;AACb,CAAC,EAzCWA,IAAI,KAAJA,IAAI;AA2ChB;;;;;AAKA,OAAO,MAAMC,MAAM,gBAAwCJ,IAAI,CAC9DD,MAAM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MACC,CAAC;EAAEG,mBAAmB;EAAEI;AAAM,CAAE,KAC/BJ,mBAAmB,GAAG,CAAC,GAAG,CAAC,GACzBA,mBAAmB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAC7BA,mBAAmB,KAAK,CAAC,GAC1BI,MAAM,GAAG,CAAC,GACR,CAAC,GACFJ,mBAAmB,KAAK,CAAC,CAAC,GAC3BI,MAAM,GAAG,CAAC,GACR,CAAC,CAAC,GACH,CAAC,CACL,CACD,EACDxB,MAAM,CAACkB,UAAU,CACjB","ignoreList":[]}
1
+ {"version":3,"file":"RoundingMode.js","names":["MMatch","flow","Function","Struct","Type","getName","make","whenIs","Ceil","constant","Floor","Expand","Trunc","HalfCeil","HalfFloor","HalfExpand","HalfTrunc","HalfEven","exhaustive","toCorrecter","firstFollowingDigit","get","Math","sign","isEven"],"sources":["../../esm/RoundingMode.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAKA,SAASA,MAAM,QAAgB,uBAAuB;AACtD,SAASC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,QAAQ;AAE/C;;;;;AAKA,WAAYC,IAyCX;AAzCD,WAAYA,IAAI;EACf;EACAA,IAAA,CAAAA,IAAA,sBAAQ;EACR;EACAA,IAAA,CAAAA,IAAA,wBAAS;EACT;;;;EAIAA,IAAA,CAAAA,IAAA,0BAAU;EACV;;;;EAIAA,IAAA,CAAAA,IAAA,wBAAS;EACT;;;;EAIAA,IAAA,CAAAA,IAAA,8BAAY;EACZ;;;;EAIAA,IAAA,CAAAA,IAAA,gCAAa;EACb;;;;EAIAA,IAAA,CAAAA,IAAA,kCAAc;EACd;;;;EAIAA,IAAA,CAAAA,IAAA,gCAAa;EACb;;;;;EAKAA,IAAA,CAAAA,IAAA,8BAAY;AACb,CAAC,EAzCWA,IAAI,KAAJA,IAAI;AA2ChB;;;;;AAKA,OAAO,MAAMC,OAAO,gBAAwCJ,IAAI,CAC/DD,MAAM,CAACM,IAAI,eACXL,IAAI,c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EAAEI;AAAM,CAAE,KAC/BJ,mBAAmB,GAAG,CAAC,GAAG,CAAC,GACzBA,mBAAmB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAC7BA,mBAAmB,KAAK,CAAC,GAC1BI,MAAM,GAAG,CAAC,GACR,CAAC,GACFJ,mBAAmB,KAAK,CAAC,CAAC,GAC3BI,MAAM,GAAG,CAAC,GACR,CAAC,CAAC,GACH,CAAC,CACL,CACD,EACDxB,MAAM,CAACkB,UAAU,CACjB","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * This module allows you to round numbers and BigDecimal's according to diverse RoundingMode's with
3
- * a given precision
2
+ * This module implements a `CVRoundingOption` which describes the possible options to round a
3
+ * number or `BigDecimal` and implements the rounding algortithm
4
4
  */
5
5
  import { MBigDecimal, MBigInt, MInspectable, MNumber, MPipeable, MTypes } from '@parischap/effect-lib';
6
6
  import { BigDecimal, Equal, Hash, pipe, Predicate, Struct } from 'effect';
@@ -35,7 +35,7 @@ const proto = {
35
35
  return pipe(this.precision, Hash.hash, Hash.combine(Hash.hash(this.roundingMode)), Hash.cached(this));
36
36
  },
37
37
  [MInspectable.IdSymbol]() {
38
- return `${CVRoundingMode.toName(this.roundingMode)}RounderWith${this.precision}Precision`;
38
+ return `${CVRoundingMode.getName(this.roundingMode)}RounderWith${this.precision}Precision`;
39
39
  },
40
40
  ... /*#__PURE__*/MInspectable.BaseProto(moduleTag),
41
41
  ...MPipeable.BaseProto
@@ -43,7 +43,7 @@ const proto = {
43
43
  /** Constructor */
44
44
  const _make = params => MTypes.objectFromDataAndProto(proto, params);
45
45
  /**
46
- * Constructor
46
+ * Constructs a `CVRoundingOption` with the specified `precision` and `roundingMode`
47
47
  *
48
48
  * @category Constructors
49
49
  */
@@ -55,8 +55,8 @@ export const make = ({
55
55
  roundingMode
56
56
  });
57
57
  /**
58
- * RoundingOption instance that uses the HalfExpand Rounding mode and precision=2. Can be used in
59
- * accounting apps of most countries.
58
+ * `CVRoundingOption` instance that uses the `HalfExpand` `CVRoundingMode` and `precision=2`. Can be
59
+ * used in accounting apps of most countries througout the world
60
60
  *
61
61
  * @category Instances
62
62
  */