Redirected dependencies can provide attenuated or modified functionality as fits the application. For example, log data about timing of function durations by wrapping the original:

    1. const original = require('fn');
    2. module.exports = function fn(...args) {
    3. console.time();
    4. try {
    5. return new.target ?
    6. Reflect.construct(original, args) :
    7. Reflect.apply(original, this, args);
    8. } finally {
    9. console.timeEnd();
    10. }
    11. };