Permalink
Browse files

arrays: improved description

  • Loading branch information...
dg committed Oct 5, 2018
1 parent 4a7b590 commit 6721f28fb5707fbee420d503c8a2d2fd1e686a8c
Showing with 12 additions and 12 deletions.
  1. +6 −6 cs/arrays.texy
  2. +6 −6 en/arrays.texy
@@ -197,37 +197,37 @@ $c = Arrays::pick($array, 'not-exists');
some(array $arr, callable $callback): bool .[method]
----------------------------------------------------

Otestuje, zda-li nějaký prvek v poli odpovídá podmínce v `$callback`.
Otestuje, zda-li nějaký prvek v poli odpovídá podmínce v `$callback`, která má signaturu `function ($value, $key, array $arr): bool`.

/--php
$array = ['foo', 'bar', 'baz'];
// have some bar???
$res = Arrays::some($array, function ($value, $key, $arr) { return $value === 'bar'; });
$res = Arrays::some($array, function ($value) { return $value === 'bar'; });
// $res = true
\--


every(array $arr, callable $callback): bool .[method]
-----------------------------------------------------

Otestuje, zda-li všechny prvky v poli odpovídají podmínce v `$callback`.
Otestuje, zda-li všechny prvky v poli odpovídají podmínce v `$callback`, která má signaturu `function ($value, $key, array $arr): bool`.

/--php
$array = ['foo', 'bar', 'baz'];
// have only bar???
$res = Arrays::every($array, function ($value, $key, $arr) { return $value === 'bar'; });
$res = Arrays::every($array, function ($value) { return $value === 'bar'; });
// $res = false
\--


map(array $arr, callable $callback): array .[method]
----------------------------------------------------

Aplikuje `$callback` na všechny prvky v poli a vrátí pole s vrácenými hodnotami.
Aplikuje `$callback` na všechny prvky v poli a vrátí pole s vrácenými hodnotami, která má signaturu `function ($value, $key, array $arr): bool`.

/--php
$array = ['foo', 'bar', 'baz'];
$res = Arrays::map($array, function ($value, $key, $arr) { return $value . $value; });
$res = Arrays::map($array, function ($value) { return $value . $value; });
// $res = ['foofoo', 'barbar', 'bazbaz']
\--

@@ -197,37 +197,37 @@ $c = Arrays::pick($array, 'not-exists');
some(array $arr, callable $callback): bool .[method]
----------------------------------------------------

Check if some item of the array go through condition in `$callback`.
Check if some item of the array go through condition in `$callback`, which has the signature `function ($value, $key, array $arr): bool`.

/--php
$array = ['foo', 'bar', 'baz'];
// have some bar???
$res = Arrays::some($array, function ($value, $key, $arr) { return $value === 'bar'; });
$res = Arrays::some($array, function ($value) { return $value === 'bar'; });
// $res = true
\--


every(array $arr, callable $callback): bool .[method]
-----------------------------------------------------

Check if all items of the array go through condition in `$callback`.
Check if all items of the array go through condition in `$callback`, which has the signature `function ($value, $key, array $arr): bool`.

/--php
$array = ['foo', 'bar', 'baz'];
// have only bar???
$res = Arrays::every($array, function ($value, $key, $arr) { return $value === 'bar'; });
$res = Arrays::every($array, function ($value) { return $value === 'bar'; });
// $res = false
\--


map(array $arr, callable $callback): array .[method]
----------------------------------------------------

Apply `$callback` to the all items in array and return results.
Apply `$callback` to the all items in array and return results, which has the signature `function ($value, $key, array $arr): bool`.

/--php
$array = ['foo', 'bar', 'baz'];
$res = Arrays::map($array, function ($value, $key, $arr) { return $value . $value; });
$res = Arrays::map($array, function ($value) { return $value . $value; });
// $res = ['foofoo', 'barbar', 'bazbaz']
\--

0 comments on commit 6721f28

Please sign in to comment.