module.exports = function()

in packages/docpack-examples-compiler/lib/loader.js [6:32]


module.exports = function () {
  this.cacheable && this.cacheable();
  var done = this.async();
  var query = loaderUtils.parseQuery(this.query);
  var data = this[sharedDataPropertyName];
  var value;

  if (query.path) {
    value = dotty.get(data, query.path);
  }
  else {
    value = data;
  }

  if (typeof value == 'undefined') {
    var msg;
    if (query.path) {
      msg = 'Shared data value with key "'+ query.path +'" not found';
    } else {
      msg = 'Undefined is not allowed as shared data';
    }
    done(new Error(msg));
    return;
  }

  done(null, value);
};