Repository navigation
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 theexplodeoperation)
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