HH\Lib\Keyset\chunk

This API is part of the Hack Standard Library, not HHVM itself.
Facebook Engineer?

This function is available as Keyset\chunk() in Facebook's www repository.

Returns a vec containing the given Traversable split into chunks of the given size

Description

namespace HH\Lib\Keyset;

function chunk<Tv as arraykey>(
  Traversable<Tv> $traversable,
  int $size,
): vec<keyset<Tv>>;

If the given Traversable doesn't divide evenly, the final chunk will be smaller than the specified size. If there are duplicate values in the Traversable, some chunks may be smaller than the specified size.

Parameters