Remove `arguments.caller` and `arguments.callee`

JavaScript pattern

arguments.caller and arguments.called have been deprecated.

They make code optimizations difficult and their use is forbidden in ECMAScript 5 while in strict mode.


Apply with the Grit CLI
grit apply no_caller

Remove arguments.callee

BEFORE
function factorial(n) {
  return n == 1 ? 1 : n * arguments.callee(n - 1);
}
AFTER
function factorial(n) {
  return n == 1 ? 1 : n * factorial(n - 1);
}

Remove arguments.caller

BEFORE
function whoCalled() {
  if (arguments.caller == null) alert("Call from the global scope.");
  else alert(arguments.caller + " call me!");
}
AFTER
function whoCalled() {
  if (whoCalled.caller == null) alert("Call from the global scope.");
  else alert(whoCalled.caller + " call me!");
}