serafim / placeholder
Simple placeholder implementation for functional constructions
Installs: 255
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/serafim/placeholder
Requires
- php: >=7.1.3
- serafim/symbol: ~1.0
Requires (Dev)
- phpunit/phpunit: ~7.5
This package is auto-updated.
Last update: 2020-08-08 23:35:07 UTC
README
Placeholder
Library provides a placeholder implementation for currying functions, partial applications, pipe operator, and other syntactic structures hat allow specifying default values.
Usage
What is "placeholder"?
<?php var_dump(is_placeholder('_')); // expected output: false var_dump(is_placeholder(_)); // expected output: true
For example we can replace each of the placeholders in the array with the required value.
<?php use Serafim\Placeholder\Placeholder; $array = [1, _, 3, _]; $result = Placeholder::map($array, fn() => ' map '); echo implode(', ', $result); // expected output: "1, map, 3, map"
And... Thats all =)