Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (lineCount < this.loadCount) {
block.lines = block.lines.slice(0, this.loadCount - lineCount);
blocks.push(block);
}
lineCount += length;
return blocks;
}, []);
}
this.diffJson[0].isTrimmed = true;
this.loadMoreCount(Math.min(loadLimit, Math.max(0, lineCount - this.loadCount)));
let html;
if (this.textDiffType.value() === 'sidebysidediff') {
html = diff2html.getPrettySideBySideHtmlFromJson(this.diffJson);
} else {
html = diff2html.getPrettyHtmlFromJson(this.diffJson);
}
this.numberOfSelectedPatchLines = 0;
let index = 0;
// ko's binding resolution is not recursive, which means below ko.bind refresh method doesn't work for
// data bind at getPatchCheckBox that is rendered with "html" binding.
// which is reason why manually updating the html content and refreshing kobinding to have it render...
if (this.patchLineList) {
html = html.replace(/<span class="d2h-code-line-[a-z]+">(\+|\-)/g, (match, capture) => {
if (this.patchLineList()[index] === undefined) {
this.patchLineList()[index] = true;
}
</span>
SideBySideDiffViewModel.prototype.render = function() {
var diffJsonCopy = JSON.parse(JSON.stringify(this.diffJson));
var diffLines = diffJsonCopy[0].blocks[0].lines;
if (diffLines.length > this.loadLimit) {
diffJsonCopy[0].blocks[0].lines = diffLines.slice(0, this.loadLimit);
this.isMoreToLoad(true);
} else {
this.isMoreToLoad(false);
}
this.diffHtml(diff2html.getPrettySideBySideHtmlFromJson(diffJsonCopy));
};