UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

49 lines (36 loc) 939 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _defineProperty2() { const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); _defineProperty2 = function () { return data; }; return data; } class Ref { constructor(hash) { (0, _defineProperty2().default)(this, "hash", void 0); 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;