Javascript equivalent of Laravel's PHP Array Helpers