function toJsonReplacer(key, value) {
  var val = value;

  if (/^\$+/.test(key)) {
    val = undefined;
  } else if (isWindow(value)) {
    val = '$WINDOW';
  } else if (value &&  document === value) {
    val = '$DOCUMENT';
  } else if (isScope(value)) {
    val = '$SCOPE';
  }

  return val;
}
@ngdoc function
@name angular.bind
@function

@description
Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
`fn`). You can supply optional `args` that are are prebound to the function. This feature is also
known as [function currying](http://en.wikipedia.org/wiki/Currying).

@param {Object} self Context which `fn` should be evaluated in.
@param {function()} fn Function to be bound.
@param {...*} args Optional arguments to be prebound to the `fn` function call.
@returns {function()} Function that wraps the `fn` with all the specified bindings.