Conditional and repeated function invocation for node and browser.