Skip to content
This repository was archived by the owner on Jul 13, 2024. It is now read-only.

Commit e356682

Browse files
committed
Refactor conditional assignment with a fallback
1 parent b9cfca2 commit e356682

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/gitgraph.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,7 @@
678678
// If there is commit in this branch, set parentCommit to last commit of this branch
679679
// otherwise, set parentCommit to this.parentCommit, the start point of this branch
680680
if (!options.parentCommit) {
681-
if (_getLast(this.commits)) {
682-
options.parentCommit = _getLast(this.commits);
683-
} else {
684-
options.parentCommit = this.parentCommit;
685-
}
681+
options.parentCommit = _getLast(this.commits) || this.parentCommit;
686682
}
687683

688684
// Special compact mode
@@ -930,8 +926,8 @@
930926

931927
var detailOffsetY = 0;
932928

933-
if(commitOptions.detail) {
934-
if(this.parent.orientation === "vertical") {
929+
if (commitOptions.detail) {
930+
if (this.parent.orientation === "vertical") {
935931
detailOffsetY = -1 * commitOptions.detail.clientHeight;
936932
} else if (this.parent.orientation === "vertical-reverse") {
937933
detailOffsetY = commitOptions.detail.clientHeight;

0 commit comments

Comments
 (0)