Skip to content

v2.0.0

Compare
Choose a tag to compare
@mpetrovich mpetrovich released this 17 Mar 20:51

Breaking changes

  • Auto-curry option removed from Dash::setCustom(): The optional third parameter, $makeCurryable, allowed custom methods to be auto-curried by prefixing them with an underscore when invoking them on a chain (eg. ->_fooBar()). However, in v1.0.0, underscore-prefixing of curried functions was replaced with a new Dash\Curry namespace, so this behavior is no longer consistent with the built-in currying semantics. To replicate this behavior, use Dash\curry() with Dash\thru():
$greet = function($greeting, $name) { return "$greeting, $name"; };
Dash\Dash::setCustom('greet', $greet);

// Previously:
$greetings = Dash\chain('John')
	->_greet('Hello')
	->value();

// Now:
$greetings = Dash\chain('John')
	->thru(Dash\curry($greet, 'Hello'))
	->value();

// $greetings === 'Hello, John'