Nice package! So annoying that PHP doesn't provide this logic in their standard libs. However, even with these functions i still have to type check before calling them: $iterable instanceof \Traversable ? iterator_xxx : array_xxx. Would be epic if agnostic variants where introduced (e.g. iterable_map, iterable_keys, iterable_flip. Then you could just pas an iterable and the function would do the rest. I think they should return what they where fed so array if is_array($iterable), otherwise \Traversable.
Nice package! So annoying that PHP doesn't provide this logic in their standard libs. However, even with these functions i still have to type check before calling them:
$iterable instanceof \Traversable ? iterator_xxx : array_xxx. Would be epic if agnostic variants where introduced (e.g.iterable_map,iterable_keys,iterable_flip. Then you could just pas aniterableand the function would do the rest. I think they should return what they where fed soarrayifis_array($iterable), otherwise\Traversable.