Replace navigator before any modules are required(), to ensure it happens as soon as possible. We replace it so that properties that can't be clobbered can instead be overridden.
161427
function replaceNavigator (origNavigator) {
    var CordovaNavigator = function () {};
    CordovaNavigator.prototype = origNavigator;
    var newNavigator = new CordovaNavigator();
    // This work-around really only applies to new APIs that are newer than Function.bind.
    // Without it, APIs such as getGamepads() break.
    if (CordovaNavigator.bind) {
        for (var key in origNavigator) {
            if (typeof origNavigator[key] === 'function') {
                newNavigator[key] = origNavigator[key].bind(origNavigator);
            } else {
                (function (k) {
                    utils.defineGetterSetter(newNavigator, key, function () {
                        return origNavigator[k];
                    });
                })(key);
            }
        }
    }
    return newNavigator;
}
405319
function replaceDirect(brstars, replacer) {
    replacer(['require'], function(node) {
      var caller = node.parent
      if (!node.arguments.length) return
      if (!caller.arguments) return
      if (!caller.arguments.length) return
      var value = evaluate(caller.arguments[0])
      if (!value) return
      var source = evaluate(node.arguments[0])
      if (!source) return

      source = resolve.sync(source, {
        basedir: dirname
      })

      var index = brstars.indexOf(source)
      if (index === -1) return

      value = require(source)(value)
      replaceCount += 1
      hijack(caller, value)
    })
  }
135249
function overrideConfig( path, value ) {
      beforeAll( () => {
         configurationOverrides[ path ] = value;
      } );
      afterAll( () => {
         delete configurationOverrides[ path ];
      } );
   }
1086224
def replace(placeholder, actual)
      raise 'wrong placeholder' if placeholder != @target
      @target.heads.delete(ptrs[0]) if @target
      @target = actual
      @target.heads << @ptrs[0]
      @symbols.map! { |s| s == placeholder ? actual : s }
    end
789012
function() {
		var me = this;

		if (core_plugins.notify(me, 'beforeLayout') === false) {
			return;
		}

		core_layouts.update(this, this.width, this.height);

		/**
		 * Provided for backward compatibility, use `afterLayout` instead.
		 * @method IPlugin#afterScaleUpdate
		 * @deprecated since version 2.5.0
		 * @todo remove at version 3
		 * @private
		 */
		core_plugins.notify(me, 'afterScaleUpdate');
		core_plugins.notify(me, 'afterLayout');
	}
575116
function checkNextRequire(options) {

		if (!modulep) {
			return;
		}

		if (options.strict === false) {
			return;
		}

		// Overwrite the original wrap method
		modulep.wrap = function wrap(script) {

			var head;

			// Restore the original functions
			modulep.wrap = modulep.original_wrap;
			modulep._resolveFilename = modulep.original_resolve;

			if (options.add_wrapper !== false) {
				if (options.add_wrapper || script.slice(0, 14) != 'module.exports') {

					if (script.indexOf('__cov_') > -1 && script.indexOf('module.exports=function ') > 7) {
						// We're in coverage mode, just ignore
					} else {
						// Yes: "added_wrapper", as in "done"
						options.added_wrapper = true;

						head = 'module.exports = function(';

						if (options.arguments) {
							head += Blast.getArgumentConfiguration(options.arguments).names.join(',');
						} else {
							head += 'Blast, Collection, Bound, Obj';
						}

						head += ') {';

						script = head + script + '\n};';
					}
				}
			}

			// Add the strict wrapper for this requirement
			return modulep.strict_wrapper + script + modulep.wrapper[1];
		};

		// Overwrite the original _resolveFilename method
		modulep._resolveFilename = function _resolveFilename(request, parent, is_main) {
			try {
				return modulep.original_resolve(request, parent, is_main);
			} catch (err) {
				modulep.wrap = modulep.original_wrap;
				modulep._resolveFilename = modulep.original_resolve;
				throw err;
			}
		};
	}
233834
function replaceNode(replacementNode, node) {
  remove(replacementNode)
  node.parentNode.insertBefore(replacementNode, node)
  remove(node)
}
498735
public static void replaceComponent(Component component, Component replacement) {

        if (!component.isAttached()) {
            throw new IllegalArgumentException("Component must be attached");
        }
        HasComponents parent = component.getParent();
        if (parent instanceof ComponentContainer) {
            ((ComponentContainer)parent).replaceComponent(component, replacement);
        } else if (parent instanceof SingleComponentContainer) {
            ((SingleComponentContainer)parent).setContent(replacement);
        } else {
            throw new IllegalArgumentException("Illegal class for parent: " + parent.getClass());
        }
    }
1306704
function replaceRequire(code, codeDepth) {
    return code.replace(REG_REQUIRE, function ($0, $1, moduleId) {

        if (REG_DEP_MODULE.test(moduleId)) {
            moduleId = codeDepth + DEP_PARH + moduleId;
        }
        else if (REG_TOP_MODULE.test(moduleId)) {
            moduleId = codeDepth + moduleId;
        }
        return 'require(\'' + moduleId + '\')';
    });
}
1002748
function override(route, thing) {

		// Resolve module location from given path
		const filename = _require.resolve(route);

		// Load it into memory
		_require(filename);

		// Override exports with new value
		_require.cache[filename].exports = thing;

		// Return exports value
		return _require(filename);
	}
1168501
def del_module(self, module):
        """"""
        rev = util.get_latest_revision(module)
        del self.modules[(module.arg, rev)]
567551
def _mk_imp_override(srcname, replacement):
    
    class DummyImporter(object):
        def find_module(self, fullname, path):
            if fullname == srcname:
                return self

            return None

        def load_module(self, fullname):
            if fullname != srcname:
                raise ImportError
            sys.modules[fullname] = replacement
            return replacement

    obj = DummyImporter()
    sys.meta_path.append(obj)
403724
def replace(self):
        
        with zero_downtime_index(self.alias_name, self.index_config()) as target_index:
            self.index_all(target_index)
1138979
function replaceRefObj (obj, resolvedValues, baseId, replaced) {
            // if found $ref key, other properties of the obj will be ignored
            if (obj.$ref) {
                var refId = url.resolve(baseId, obj.$ref);
                if (refId in resolvedValues) {
                    replaced[refId] = resolvedValues[refId];
                    return resolvedValues[refId];
                }
            }

            _.forOwn(obj, function(val, k) {
                if (!(val instanceof Object)) {
                    return true; //continue
                }

                var resolvedObj = replaceRefObj(val, resolvedValues, baseId, replaced);
                if (resolvedObj) {
                    obj[k] = resolvedObj;
                }
            });
        }
1237847
function () {
                var navManager = ariaTemplatesNavigationManager;
                navManager.removeGlobalKeyMap({
                    key : "ESCAPE",
                    modal : true,
                    callback : {
                        fn : this._raiseOnEscapeEvent,
                        scope : this
                    }
                });
                // restore globalKeyMap
                navManager.setModalBehaviour(false);
            }
284909
function TransformPlaceholderArgs({
    rawDependencies,
    args,
    replaceArgs = {}
}) {
    const dependencies = [...rawDependencies];
    // clone

    const dependenciesArgs = dependencies.map((dependency, i) => {
        const arg = args[i];
        if (dependency && replaceArgs[dependency]) {
            return replaceArgs[dependency];
        }
        return arg;
    });
    return [...dependenciesArgs, ...args.slice(dependenciesArgs.length)];
}
575230
def replace_component(self, name, callable, provides=None, depends=None):
        """"""
        self.remove_component(name)
        self.add_component(name, callable, provides, depends)