index.js
function lazy(obj, prop, fn) {
  Object.defineProperty(obj, prop, {
    configurable: true,

    get: function get() {
      return Object.defineProperty(this, prop, {
        value: fn.call(this)
      })[prop];
    },

    set: function set(value) {
      return Object.defineProperty(this, prop, {
        value: value
      })[prop];
    }
  });
}
function lazy(obj, prop, fn) {
  Object.defineProperty(obj, prop, {
    configurable: true,

    get: function get() {
      return Object.defineProperty(this, prop, {
        value: fn.call(this)
      })[prop];
    },

    set: function set(value) {
      return Object.defineProperty(this, prop, {
        value: value
      })[prop];
    }
  });
}
function lazy ( obj , prop , fn ) { Object . defineProperty ( obj , prop , { configurable : true , get : function get ( ) { return Object . defineProperty ( this , prop , { value : fn . call ( this ) } ) [ prop ] ; } , set : function set ( value ) { return Object . defineProperty ( this , prop , { value : value } ) [ prop ] ; } } ) ; }
Lazy initialization pattern.

@param {Object} obj The object where we need to add lazy loading prop.
@param {String} prop The name of the property that should lazy load.
@param {Function} fn The function that returns the lazy laoded value.
@api public
Lazy initialization pattern .