Skip to content

Commit 1045d6d

Browse files
committed
Update function list
1 parent f6bdc99 commit 1045d6d

File tree

1 file changed

+4
-112
lines changed

1 file changed

+4
-112
lines changed

docs/functions.rst

+4-112
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Phamda functions
22
================
33

4-
Currently included functions (110):
4+
Currently included functions (104):
55

66

77

@@ -408,31 +408,11 @@ Calls the given function for each element in the collection and returns the orig
408408

409409
The supplied ``function`` receives three arguments: ``item``, ``index``, ``collection``.
410410

411-
.. code-block:: php
412-
413-
$date = new \DateTime('2015-02-02');
414-
$addDays = function ($number) use ($date) { $date->modify("+{$number} days"); };
415-
P::each($addDays, [3, 6, 2]);
416-
$date->format('Y-m-d'); // => '2015-02-13'
417-
418-
419-
.. _eachIndexed:
420-
421-
eachIndexed
422-
-----------
423-
``array|\Traversable|Collection P::eachIndexed(callable $function, array|\Traversable|Collection $collection)``
424-
425-
Deprecated since version 0.4, to be removed in 0.5. The callback of ``each`` now receives three arguments as well.
426-
427-
Calls the given function for each element in the collection and returns the original collection.
428-
429-
Like ``each``, but the supplied ``function`` receives three arguments: ``item``, ``index``, ``collection``.
430-
431411
.. code-block:: php
432412
433413
$date = new \DateTime('2015-02-02');
434414
$addCalendar = function ($number, $type) use ($date) { $date->modify("+{$number} {$type}"); };
435-
P::eachIndexed($addCalendar, ['months' => 3, 'weeks' => 6, 'days' => 2]);
415+
P::each($addCalendar, ['months' => 3, 'weeks' => 6, 'days' => 2]);
436416
$date->format('Y-m-d'); // => '2015-06-15'
437417
438418
@@ -528,24 +508,6 @@ The supplied ``predicate`` receives three arguments: ``item``, ``index``, ``coll
528508
P::filter($gt2, ['foo' => 2, 'bar' => 3, 'baz' => 4]); // => ['bar' => 3, 'baz' => 4]
529509
530510
531-
.. _filterIndexed:
532-
533-
filterIndexed
534-
-------------
535-
``array|Collection P::filterIndexed(callable $predicate, array|\Traversable|Collection $collection)``
536-
537-
Deprecated since version 0.4, to be removed in 0.5. The callback of ``filter`` now receives three arguments as well.
538-
539-
Returns a new collection containing the items that match the given predicate.
540-
541-
Like ``filter``, but the supplied ``predicate`` receives three arguments: ``item``, ``index``, ``collection``.
542-
543-
.. code-block:: php
544-
545-
$smallerThanNext = function ($value, $key, $list) { return isset($list[$key + 1]) ? $value < $list[$key + 1] : false; };
546-
P::filterIndexed($smallerThanNext, [3, 6, 2, 19]); // => [0 => 3, 2 => 2]
547-
548-
549511
.. _find:
550512

551513
find
@@ -896,24 +858,8 @@ The supplied ``function`` receives three arguments: ``item``, ``index``, ``colle
896858
897859
$square = function ($x) { return $x ** 2; };
898860
P::map($square, [1, 2, 3, 4]); // => [1, 4, 9, 16]
899-
900-
901-
.. _mapIndexed:
902-
903-
mapIndexed
904-
----------
905-
``array|Collection P::mapIndexed(callable $function, array|\Traversable|Collection $collection)``
906-
907-
Deprecated since version 0.4, to be removed in 0.5. The callback of ``map`` now receives three arguments as well.
908-
909-
Returns a new collection where values are created from the original collection by calling the supplied function.
910-
911-
Like ``map``, but the supplied ``function`` receives three arguments: ``item``, ``index``, ``collection``.
912-
913-
.. code-block:: php
914-
915861
$keyExp = function ($value, $key) { return $value ** $key; };
916-
P::mapIndexed($keyExp, [1, 2, 3, 4]); // => [1, 2, 9, 64]
862+
P::map($keyExp, [1, 2, 3, 4]); // => [1, 2, 9, 64]
917863
918864
919865
.. _max:
@@ -1297,24 +1243,6 @@ The supplied ``function`` receives four arguments: ``previousValue``, ``item``,
12971243
P::reduce($concat, 'foo', ['bar', 'baz']); // => 'foobarbaz'
12981244
12991245
1300-
.. _reduceIndexed:
1301-
1302-
reduceIndexed
1303-
-------------
1304-
``mixed P::reduceIndexed(callable $function, mixed $initial, array|\Traversable $collection)``
1305-
1306-
Deprecated since version 0.4, to be removed in 0.5. The callback of ``reduce`` now receives four arguments as well.
1307-
1308-
Returns a value accumulated by calling the given function for each element of the collection.
1309-
1310-
Like ``reduce``, but the supplied ``function`` receives four arguments: ``previousValue``, ``item``, ``index``, ``collection``.
1311-
1312-
.. code-block:: php
1313-
1314-
$concat = function ($accumulator, $value, $key) { return $accumulator . $key . $value; };
1315-
P::reduceIndexed($concat, 'no', ['foo' => 'bar', 'fiz' => 'buz']); // => 'nofoobarfizbuz'
1316-
1317-
13181246
.. _reduceRight:
13191247

13201248
reduceRight
@@ -1325,28 +1253,10 @@ Returns a value accumulated by calling the given function for each element of th
13251253

13261254
The supplied ``function`` receives four arguments: ``previousValue``, ``item``, ``index``, ``collection``.
13271255

1328-
.. code-block:: php
1329-
1330-
$concat = function ($x, $y) { return $x . $y; };
1331-
P::reduceRight($concat, 'foo', ['bar', 'baz']); // => 'foobazbar'
1332-
1333-
1334-
.. _reduceRightIndexed:
1335-
1336-
reduceRightIndexed
1337-
------------------
1338-
``mixed P::reduceRightIndexed(callable $function, mixed $initial, array|\Traversable $collection)``
1339-
1340-
Deprecated since version 0.4, to be removed in 0.5. The callback of ``reduceRight`` now receives four arguments as well.
1341-
1342-
Returns a value accumulated by calling the given function for each element of the collection in reverse order.
1343-
1344-
Like ``reduceRight``, but the supplied ``function`` receives four arguments: ``previousValue``, ``item``, ``index``, ``collection``.
1345-
13461256
.. code-block:: php
13471257
13481258
$concat = function ($accumulator, $value, $key) { return $accumulator . $key . $value; };
1349-
P::reduceRightIndexed($concat, 'no', ['foo' => 'bar', 'fiz' => 'buz']); // => 'nofizbuzfoobar'
1259+
P::reduceRight($concat, 'no', ['foo' => 'bar', 'fiz' => 'buz']); // => 'nofizbuzfoobar'
13501260
13511261
13521262
.. _reject:
@@ -1365,24 +1275,6 @@ The supplied ``predicate`` receives three arguments: ``item``, ``index``, ``coll
13651275
P::reject($isEven, [1, 2, 3, 4]); // => [0 => 1, 2 => 3]
13661276
13671277
1368-
.. _rejectIndexed:
1369-
1370-
rejectIndexed
1371-
-------------
1372-
``array|Collection P::rejectIndexed(callable $predicate, array|\Traversable|Collection $collection)``
1373-
1374-
Deprecated since version 0.4, to be removed in 0.5. The callback of ``reject`` now receives three arguments as well.
1375-
1376-
Returns a new collection containing the items that do not match the given predicate.
1377-
1378-
Like ``reject``, but the supplied ``predicate`` receives three arguments: ``item``, ``index``, ``collection``.
1379-
1380-
.. code-block:: php
1381-
1382-
$smallerThanNext = function ($value, $key, $list) { return isset($list[$key + 1]) ? $value < $list[$key + 1] : false; };
1383-
P::rejectIndexed($smallerThanNext, [3, 6, 2, 19]); // => [1 => 6, 3 => 19]
1384-
1385-
13861278
.. _reverse:
13871279

13881280
reverse

0 commit comments

Comments
 (0)