"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

function _object() {
  const data = _interopRequireDefault(require("./object"));

  _object = function () {
    return data;
  };

  return data;
}

class Ref {
  constructor(hash) {
    if (!hash) throw new Error('failed creating a Ref object, the hash argument is empty');
    this.hash = hash;
  }

  toString() {
    return this.hash;
  }

  load(repository, throws = false) {
    return repository.load(this, throws);
  }

  loadSync(repo, throws = true) {
    return repo.loadSync(this, throws);
  }

  loadRaw(repo) {
    return repo.loadRaw(this);
  }

  static from(hash) {
    return new Ref(hash);
  }

}

exports.default = Ref;