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

42 lines (33 loc) 889 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; // eslint-disable-next-line import/no-cycle // todo: change to "import type" once babel supports it /** * `Snap` represents a sealed state of the component in the working tree. */ class Snap { constructor(timestamp, parents, author, message, state) { this.timestamp = timestamp; this.parents = parents; this.author = author; this.message = message; this.state = state; } /** * hash of the snap. */ get hash() { // eslint-disable-line @typescript-eslint/no-unused-vars return this.state.hash; } /** * create a snap from a component */ static create(component, author, message = '') { return new Snap(new Date(), component.head ? [component.head] : [], author, message, component.state); } } exports.default = Snap;