Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
esyede committed Nov 22, 2023
1 parent 2855260 commit 285f8a4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions system/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,26 @@ function data_set(&$target, $key, $value, $overwrite = true)
}
}

if (!function_exists('tap')) {
/**
* Panggil closure dengan value yang diberikan lalu return hasilnya.
*
* @param mixed $value
* @param \Closure $callback
*
* @return mixed
*/
function tap($value, \Closure $callback)
{
if (is_null($callback) || !($callback instanceof \Closure)) {
return $value;
}

$callback($value);
return $value;
}
}

if (!function_exists('retry')) {
/**
* Ulangi eksekusi sebanyak jumlah yang diberikan.
Expand Down

0 comments on commit 285f8a4

Please sign in to comment.