lib/rfr.js
function(callable, root, isMaster) {
  rfr = callable.bind(callable);

  /**
   * A read-only property tells whether this rfr instance is a master one.
   * Call `require('rfr')` to get a master rfr instance.
   * User created rfr instances, such as `require('rfr')({ root: '...' })` are
   * not master ones.
   * @type {Boolean}
   */
  Object.defineProperty(rfr, 'isMaster', {
    configurable: false,
    enumerable: true,
    value: !!isMaster,
    writable: false
  });

  /**
   * A read-only property tells whether this rfr instance is a global master.
   * Call `require('rfr')` on a global rfr module to get a master rfr instance.
   * Using the global master is error-prone.
   * @type {Boolean}
   */
  Object.defineProperty(rfr, 'isGlobalMaster', {
    configurable: false,
    enumerable: true,
    value: constants.isGlobal && !!isMaster,
    writable: false
  });

  /**
   * The root of a rfr instance.
   * @type {String}
   */
  Object.defineProperty(rfr, 'root', {
    configurable: false,
    enumerable: true,
    get: function() {
      return callable.root;
    },
    set: function(root) {
      callable.root = coerceRoot(root);
    }
  });

  /**
   * Set the root.
   * @param {String} root The new root.
   */
  rfr.setRoot = function(root) {
    this.root = root;
  };

  /**
   * Get the filename that will be loaded when this rfr is called.
   * @returns {String} module filename.
   */
  rfr.resolve = function(idFromRoot) {
    return require.resolve(normalizeId(idFromRoot, this.root));
  };

  rfr.root = root;
  return rfr;
}
function(callable, root, isMaster) {
  rfr = callable.bind(callable);

  /**
   * A read-only property tells whether this rfr instance is a master one.
   * Call `require('rfr')` to get a master rfr instance.
   * User created rfr instances, such as `require('rfr')({ root: '...' })` are
   * not master ones.
   * @type {Boolean}
   */
  Object.defineProperty(rfr, 'isMaster', {
    configurable: false,
    enumerable: true,
    value: !!isMaster,
    writable: false
  });

  /**
   * A read-only property tells whether this rfr instance is a global master.
   * Call `require('rfr')` on a global rfr module to get a master rfr instance.
   * Using the global master is error-prone.
   * @type {Boolean}
   */
  Object.defineProperty(rfr, 'isGlobalMaster', {
    configurable: false,
    enumerable: true,
    value: constants.isGlobal && !!isMaster,
    writable: false
  });

  /**
   * The root of a rfr instance.
   * @type {String}
   */
  Object.defineProperty(rfr, 'root', {
    configurable: false,
    enumerable: true,
    get: function() {
      return callable.root;
    },
    set: function(root) {
      callable.root = coerceRoot(root);
    }
  });

  /**
   * Set the root.
   * @param {String} root The new root.
   */
  rfr.setRoot = function(root) {
    this.root = root;
  };

  /**
   * Get the filename that will be loaded when this rfr is called.
   * @returns {String} module filename.
   */
  rfr.resolve = function(idFromRoot) {
    return require.resolve(normalizeId(idFromRoot, this.root));
  };

  rfr.root = root;
  return rfr;
}
function ( callable , root , isMaster ) { rfr = callable . bind ( callable ) ; /**
   * A read-only property tells whether this rfr instance is a master one.
   * Call `require('rfr')` to get a master rfr instance.
   * User created rfr instances, such as `require('rfr')({ root: '...' })` are
   * not master ones.
   * @type {Boolean}
   */ Object . defineProperty ( rfr , 'isMaster' , { configurable : false , enumerable : true , value : ! ! isMaster , writable : false } ) ; /**
   * A read-only property tells whether this rfr instance is a global master.
   * Call `require('rfr')` on a global rfr module to get a master rfr instance.
   * Using the global master is error-prone.
   * @type {Boolean}
   */ Object . defineProperty ( rfr , 'isGlobalMaster' , { configurable : false , enumerable : true , value : constants . isGlobal && ! ! isMaster , writable : false } ) ; /**
   * The root of a rfr instance.
   * @type {String}
   */ Object . defineProperty ( rfr , 'root' , { configurable : false , enumerable : true , get : function ( ) { return callable . root ; } , set : function ( root ) { callable . root = coerceRoot ( root ) ; } } ) ; /**
   * Set the root.
   * @param {String} root The new root.
   */ rfr . setRoot = function ( root ) { this . root = root ; } ; /**
   * Get the filename that will be loaded when this rfr is called.
   * @returns {String} module filename.
   */ rfr . resolve = function ( idFromRoot ) { return require . resolve ( normalizeId ( idFromRoot , this . root ) ) ; } ; rfr . root = root ; return rfr ; }
Create a new version of rfr with a function.
@param {Function} callable The rfr require function.
@param {String} root The root for rfr require.
@param {Boolean} isMaster Whether this is a master rfr.
@private
Create a new version of rfr with a function .