Releases: revinate/sequence
Releases · revinate/sequence
PHP 7.x compatibility
Update revinate/php-getter-setter library
PHP 7.x compatibility
BC changes:
- Moved
fnnamespace intofuncone. PHP 7.4 usesfnas token for arrow functions.
Other changes:
- Fixed tests
- Minor code style/performance improvements
PHP 7.x compatibility
Update revinate/php-getter-setter library
PHP 7.x compatibility
BC changes: - Moved `fn` namespace into `func` one. PHP 7.4 uses `fn` as token for arrow functions. Other changes: - Fixed tests - Minor code style/performance improvements
PHP 7.x compatibility
fn keyword is reserved in php^7.1
Removed the usage of a keyword
BC changes:
- namespace
fn->func
Add fnMapFromField
Summary
Added the function fnMapFromField.
fnMapFromField is useful when combined with fnMapToField.
...
->map(fn\fnMapToField('tax', fnMapFromField('price', $fnCalcTax)))
...
Add fnMapToField
fnMapToField allows you to take the result of a mapping function and write it to a field.
Add multiple comparison function for sorting.
Summary
Added the ability to chain comparison functions together for improved sorting.
fn\fnCompareMulti
fn\CompareMulti lets you chain comparison functions together for sorting recorder based upon different fields.
Example
usort($records, fn\fnCompareMulti([
fn\fnCompareFieldRev('price'), // first by price descending
fn\fnCompareField('name'), // then by name ascending
])Add scan, concatMap, and last to Sequence
Scan
Allows you to accumulate values as you go along.
Last
Returns the last value in a sequence.
concatMap
This is like flattenOnce, but it preserves the keys.
Rename fnCallChain to fnPipe for clarity
Merge pull request #11 from pbu88/rename_fn_call_chain Renames fnCallChain to fnPipe and use fnCallChain as its alias