git-cat-file
Version:
Pure JavaScript `git cat-file -p` for node.js
23 lines (22 loc) • 686 B
JavaScript
;
/**
* https://github.com/kawanet/git-cat-file
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tag = void 0;
const obj_item_1 = require("./obj-item");
class Tag extends obj_item_1.ObjItem {
constructor(obj, store) {
super(obj, store);
if (obj.type !== "tag") {
throw new TypeError(`Invalid tag object: ${obj.oid} (${obj.type})`);
}
}
getDate() {
const tagger = this.getMeta("tagger");
const match = tagger === null || tagger === void 0 ? void 0 : tagger.match(/\s+(\d+)(\s+[+\-]\d+)?$/);
if (match)
return new Date(+match[1] * 1000);
}
}
exports.Tag = Tag;