Use boolean guard instead of function replacement. In some JS engines (at least: v8, safari, ff), results in significant perf increase. Smaller, simpler code, too