Add function.repeat() and tests