@drewsonne/maya-dates
Version:
Typescript package to manipulate dates in the Maya Calendar
66 lines • 2.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapsComment = exports.CommentWrapper = void 0;
var comment_1 = require("./comment");
var i_part_1 = require("./i-part");
var guards_1 = require("./guards");
var CommentWrapper = (function () {
function CommentWrapper() {
this.comment = new comment_1.Comment('');
}
CommentWrapper.prototype.setComment = function (comment) {
var castComment = new comment_1.Comment('');
if ((0, guards_1.isStringPrimitive)(comment)) {
castComment = new comment_1.Comment(comment);
}
else {
castComment = castComment.merge(comment);
}
this.comment = castComment;
return this;
};
CommentWrapper.prototype.appendComment = function (comment) {
var castComment = new comment_1.Comment('');
if ((0, guards_1.isStringPrimitive)(comment)) {
castComment = new comment_1.Comment(comment);
}
else {
castComment = castComment.merge(comment);
}
if ((0, comment_1.isComment)(this.comment)) {
this.comment = this.comment.merge(castComment);
}
else {
this.setComment(castComment);
}
return this;
};
CommentWrapper.prototype.commentIsEqual = function (otherCommentWrapper) {
return this.comment.equals(otherCommentWrapper.comment);
};
CommentWrapper.prototype.equalWithComment = function (otherCommentWrapper) {
var result = true;
if (wrapsComment(otherCommentWrapper)) {
result && (result = this.commentIsEqual(otherCommentWrapper));
if ((0, i_part_1.isPart)(this)) {
result && (result = otherCommentWrapper.equal(this));
}
else {
result = false;
}
}
else {
result = false;
}
return result;
};
return CommentWrapper;
}());
exports.CommentWrapper = CommentWrapper;
function wrapsComment(o) {
return (o.setComment !== undefined)
&& (o.appendComment !== undefined)
&& (o.comment !== undefined);
}
exports.wrapsComment = wrapsComment;
//# sourceMappingURL=comment-wrapper.js.map