Skip to content

Commit b7f5b2d

Browse files
committed
Merge branch 'develop'
2 parents 24acd4c + e4db574 commit b7f5b2d

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

CHANGELOG.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Changelog
2-
32
All notable changes to this project will be documented in this file.
43

54
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7-
8-
## [0.0.1] - 2020-12-22
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
96

7+
## [Unreleased]
8+
- `feature/percentage`: for percentage manipulations
9+
- `feature/fraction`: for rational numbers manipulations
10+
11+
## [0.2.0] - 2020-12-23
12+
### Changed
13+
- `wholePart` and `decimalPart` methods now return `Number` instances
14+
## [0.1.0] - 2020-12-22
1015
### Added
11-
12-
- Number immutable value object
16+
- `Number` immutable value object

DOCS.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
# Documentation
2-
32
## Instanciation
4-
53
`Number::of(any)` accepts any numeric value like floats, integers and even strings or other Number instances
64

7-
e.g: `Number::of("1.5")`, `Number::of(1/3)`, `Number::of(1)`, `Number::of(Number::of(12.8))` are valid and correctly handled
8-
9-
On the other hand, the strings must be sane
5+
e.g: `Number::of("1.5")`, `Number::of(1/3)`, `Number::of(1)`, `Number::of(Number::of(12.8))` are valid and correctly handled
106

7+
On the other hand, the strings must be sane
118
e.g `Number::of('1/3')`, `Number::of('1,2')`, `Number::of('1.5€')` will throw an exception
129

1310
Basic instances are already built-in:
14-
1511
- `Number::zero()` alias for Number::of(0)
1612
- `Number::one()` alias for Number::of(1)
1713
- `Number::ten()` alias for Number::of(10)
1814
- `Number::hundred()` alias for Number::of(100)
1915
- `Number::thousand()` alias for Number::of(1000)
2016

2117
## Collections
22-
2318
- `Number::sum(...any)` return a Number which values to the sum of the values in the collection
2419
- `Number::max(...any)` return a Number which values to the max value in the collection
2520
- `Number::min(...any)` return a Number which values to the min value in the collection
@@ -28,9 +23,7 @@ Basic instances are already built-in:
2823
Those methods accepts a list of valid values (e.g: `Number::sum("2", 4, 1/2)`) as well as an iterable object (e.g: `Number::sum(["2", 4, 1/2])`)
2924

3025
## Methods
31-
3226
### Basic maths methods:
33-
3427
- `plus(any)` returns a Number which values to the sum between the two Numbers
3528
- `minus(any)` returns a Number which values to the difference between the two Numbers
3629
- `multiply(any)` returns a Number which values to the multiplication between the two Numbers
@@ -55,12 +48,12 @@ Those methods accepts a list of valid values (e.g: `Number::sum("2", 4, 1/2)`) a
5548
- `isLessOrEqual(any)` returns the inferiority comparison result
5649

5750
### Other useful methods:
58-
51+
- `wholePart()` returns a Number which value is the left part of the floating point (e.g 3.52 is 3.0)
52+
- `decimalPart()` returns a Number which value is the right part of the floating point (e.g 3.52 is 0.52)
5953
- `isPositive()` returns whether the Number value is positive or not
6054
- `isNegative()` returns whether the Number value is negative or not
6155
- `isZero()` returns whether the Number value is equal to zero
6256
- `isWhole()` returns whether the Number has a decimal part
63-
- `decimalPlaces()` returns a count of the decimal part digits
6457
- `apply(callback)` returns the callback result, useful for custom functions
6558
- `when(bool, callback)` returns the callback result if the condition is truthy
6659
- `format(locale, decimals, forceDecimals)` returns the display format of the number in the desired locale (not for database storage!)
@@ -70,8 +63,6 @@ Those methods accepts a list of valid values (e.g: `Number::sum("2", 4, 1/2)`) a
7063
- `get()` returns the raw internal float value (for debug purposes)
7164
- `value()` returns the float value, preferred over value(), because the format will be right (no strange values like -0.0)
7265
- `sign()` returns `+` or `-`. N.B: Zero will be positive.
73-
- `wholePart()` returns the left part of the floating point (e.g 3.52 is 3)
74-
- `decimalPart()` returns the right part of the floating point (e.g 3.52 is 0.52)
7566

7667
All accessors can be retrieved as properties like `->value` or `->sign`.
7768

0 commit comments

Comments
 (0)