Skip to content

Release v5.0.0

Choose a tag to compare

@klimick klimick released this 21 Nov 10:04
· 50 commits to master since this release

In addition to new functionality, this release contains backwards-incompatible changes.
Read about BC here: https://github.com/fp4php/functional/blob/master/UPGRADING-v5.md

New collection ops

  • groupMap: groupBy + map combinator
  • groupMapReduce: groupBy + map + fold combinator
  • reindex: Index each elements by callback and returns HashMap
  • firstMap: Like first but use Option data type instead bool
  • lastMap: Like last but use Option data type instead bool
  • traverseOption, traverseEither: See example
  • sorted: $callback now is optional. Will be use default PHP comparison mechanism without $callback.
  • sortedBy: allow specify value for sorting.
  • sortedDesc: allow specify value for ascending sorting.
  • sortedDescBy: allow specify value for desceding sorting.
  • flatten: Turns iterable<iterable<T>> to iterable<T>
  • zipWithKeys: Turns Seq<T> to Seq<array{int, T}>
  • init: Returns all elements except last
  • partition: Separates collection by predicate
  • partitionMap: Separates collection by predicate (but using Either)
  • toString: Returns string representation of datatype.
  • toStream: Turns collection to Stream
  • toMergedArray: Like array_merge but as method
  • toNonEmptyMergedArray: Non-empty version of toMergedArray
  • *N combinators: (mapN, flatMapN and others...)

Psalm plugin improvement

Docs