Releases: loophp/collection
2.6.0
New
I'm currently busy learning the amazing programming language Haskell and I backported into this library some stuff that I learned recently.
- Add fromFile static constructor.
7211052
- Add Words operation.
72df47a
- Add Unwords operation.
b6aef32
- Add Unlines operation.
ab9fde2
- Add Lines operation.
24cd4a5
- Add scanLeft1 operation.
8b9aaa3
- Add scanRight1 operation.
1183407
- Add scanRight operation.
c01274f
- Add scanLeft operation.
ff0c7e4
- Add FoldRight1 operation.
18b9b1d
- Add FoldLeft1 operation.
c034101
Breaking changes
There are 3 potential breaking changes in this release.
Compact
When compact was called without argument, the only value removed was null
.
Starting of 2.6.0
, when no argument is provided, it will remove all falsy values: null
, false
, 0
, ''
Before:
$input = ['a', '', null, false, 0];
Collection::fromIterable($input)
->compact(); // ['a', '', false, 0]
After:
$input = ['a', '', null, false, 0];
Collection::fromIterable($input)
->compact(); // ['a']
Explode
Explode operation now mimic the PHP core function "explode" by removing the values used to explode the collection.
Before:
$input = range('a', 'j');
Collection::fromIterable($input)
->explode('b', 'd', 'f', 'h'); // ['a', ['b', 'c'], ['d', 'e'], ['f', 'g'], ['h', 'i', 'j']]
After:
$input = range('a', 'j');
Collection::fromIterable($input)
->explode('b', 'd', 'f', 'h'); // ['a', 'c', 'e', 'g', ['i', 'j']]
Split
The Split operation now has an extra integer parameter (a flag) that describe how the split should treat the value
which is used to split the collection into chunks.
Splitable::BEFORE
: To insert that value at the beginning of the next chunk.Splitable::AFTER
: To insert that value at the end of the current chunk.Splitable::REMOVE
: To remove that value (the same as theexplode
operation)
Before:
$input = range('a', 'j');
Collection::fromIterable($input)
->split(static function ($value): bool {return $value === 'd';}
After:
$input = range('a', 'j');
Collection::fromIterable($input)
->split(
Splitable::BEFORE,
static function ($value): bool {return $value === 'd';}
)
Commits
- Breaking change: refactor: Update Compact operation.
10fd55f
- Breaking change: refactor: Update Explode operation.
d28abcd
- Breaking change: refactor: Update Split operation.
1c669b2
- feat: Add fromFile static constructor.
7211052
- feat: Add Words operation.
72df47a
- feat: Add Unwords operation.
b6aef32
- feat: Add Unlines operation.
ab9fde2
- feat: Add Lines operation.
24cd4a5
- refactor: Refactor operations using their parent operation counterpart.
0835f2d
- refactor: Update Reverse operation.
6ce7b13
- feat: Add scanLeft1 operation.
8b9aaa3
- feat: Add scanRight1 operation.
1183407
- feat: Add scanRight operation.
c01274f
- docs: Update FoldLeft and FoldRight.
98ced08
- feat: Add scanLeft operation.
ff0c7e4
- docs: Update annotations.
317483e
- feat: Add FoldRight1 operation.
18b9b1d
- feat: Add FoldLeft1 operation.
c034101
- docs: Update README.
ecdbc18
- docs: Update documentation.
7985455
- docs: Update API page.
516f786
2.5.5
2.5.4
Commits
- ci: Update release process to include changelog automatically.
abb4e4f
- Bump actions/stale from v3.0.10 to v3.0.11
f7ba528
- docs: Update Usage page.
2d5d9f6
- docs: Update documentation of Append and Prepend operations.
8441ad6
- feat: Add Duplicate operation.
b2d2a82
- docs: Updated append method documentation.
da6caa9
2.5.3
2.5.2
2.5.1
2.5.0
2.5.0
8 September 2020
Breaking changes
- Replace Only with IntersectKeys operation.
78a20a3
- Replace Iterate with Unfold operation.
6401f74
- Update Window operation.
c78813b
- Remove variadic argument
- Simplify the calculation of the stack
Improvements
- Update Limit operation.
95f8856
- Update Unpack operation.
c253472
- Use Filter operation when it's possible.
841a7c5
Miscellaneous
2.4.0
Diff with previous
Breaking changes
-
Rename Skip into Drop.
0c6b01a
- Just a simple operation rename to match the Haskell Drop operation.
-
Update Last operation.
4ae3d35
- Now the Last operation doesn't take any argument. If you want to reproduce the old behaviour, you can use a combination of Filter, Reverse and Limit operations.
-
Update First operation.
79a1f5c
- Now the First operation doesn't take any argument. If you want to reproduce the old behaviour, you can use a combination of Filter and Limit operations.
New
- Add Unzip operation.
cad956f
- Add TakeWhile operation.
c9e6701
- Add DropWhile operation.
cf816a3
- Add Current operation.
ed246ed
- Add Key operation.
24fa777
Improvements
- Update FoldLeft operation.
deb825d
- Refactor reducer callbacks.
9d1e176
- Update Associate operation.
1b9ca3c
- Update Reduction operation.
f20942c