|
1 | 1 | = Changelog
|
2 | 2 | :perfective-common: https://github.com/perfective/ts.common/tree/main
|
| 3 | +:github-issues: https://github.com/perfective/ts.common/issues |
| 4 | + |
| 5 | +== v0.11.0 |
| 6 | + |
| 7 | +* *Fixed ES modules imports*. |
| 8 | ++ |
| 9 | +`@perfective/common` can now be imported from regular `.js`/`.mjs` ESM files. |
| 10 | ++ |
| 11 | +* *Added wrappers for most of the `Math` functions* (link:{github-issues}/20[#20]) |
| 12 | ++ |
| 13 | +Unlike the standard `Math` functions, |
| 14 | +the following functions throw an `Exception` for invalid inputs: |
| 15 | ++ |
| 16 | +** `absolute()`; |
| 17 | +** `arccos()`, `arccosh()`; |
| 18 | +** `arcsin()`, `arcsinh()`; |
| 19 | +** `arctan()`, `arctan2()`, `arctanh()`; |
| 20 | +** `cos()`, `cosh()`; |
| 21 | +** `sin()`, `sinh()`; |
| 22 | +** `tan()`, `tanh()`; |
| 23 | +** `rounded()`, `roundedUp()`, `roundedDown()`, `roundedToFloat32()`, `truncated()`; |
| 24 | +** `power()`, `powerOf()`; |
| 25 | +** `squareRoot()`, `cubeRoot()`, `l2norm()`; |
| 26 | +** `exp()`, `expm1()`; |
| 27 | +** `log()`, `log10()`, `log1p()`, `log2()`; |
| 28 | +** `sign()` with `Sign` nominal type. |
| 29 | ++ |
| 30 | +Replacing `NaN` with `null` is a redundant idea, |
| 31 | +because it’s trivial to do use library functions with `Maybe` instead: |
| 32 | ++ |
| 33 | +[source,typescript] |
| 34 | +---- |
| 35 | +maybe(x).to(Math.acos).that(isNumber) |
| 36 | +---- |
| 37 | ++ |
| 38 | +Meanwhile, throwing an exception gives library users an option to track invalid inputs. |
| 39 | +In this case, the `Result` monad can be used instead: |
| 40 | ++ |
| 41 | +[source,typescript] |
| 42 | +---- |
| 43 | +result(x).onto(resultFrom(arccos)) |
| 44 | +---- |
| 45 | ++ |
| 46 | +* *Added more nominal types for numbers*: |
| 47 | ++ |
| 48 | +** Added `Infinity`, `PositiveInfinity`, and `NegativeInfinity` nominal types |
| 49 | +with the `isInfinity()` type guard. |
| 50 | ++ |
| 51 | +** Added `FiniteNumber` nominal type |
| 52 | +with the `isFinite() type guard (link:{github-issues}/18[#18]) |
| 53 | +and `assertIsFinite()` assertion. |
| 54 | ++ |
| 55 | +** Added the `PositiveNumber`, `NonPositiveNumber`, `NegativeNumber`, `NonNegativeNumber` nominal types. |
| 56 | +** Added `assertIsNonNegativeNumber()` type guard. |
| 57 | ++ |
| 58 | +* *Introduced assertion function* (link:{github-issues}/53[#53]): |
| 59 | ++ |
| 60 | +** Added the `assertIsNotNaN()` and `assertIsNonNegativeNumber()` functions. |
| 61 | +** Added the `typeException()` function. |
| 62 | + |
3 | 63 |
|
4 | 64 | == v0.10.0
|
5 | 65 |
|
|
0 commit comments