Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render diffs with unlimited depth #61

Closed
wants to merge 14 commits into from
3 changes: 2 additions & 1 deletion lib/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function diffDescriptors (lhs, rhs, options) {
const lhsCircular = new Circular()
const rhsCircular = new Circular()
const maxDepth = (options && options.maxDepth) || 0
const renderDiffWithUnlimitedDepth = (options && options.renderDiffWithUnlimitedDepth)

let indent = new Indenter(0, ' ')

Expand Down Expand Up @@ -113,7 +114,7 @@ function diffDescriptors (lhs, rhs, options) {
const formatter = subject.formatShallow(themeUtils.applyModifiers(subject, theme), indent)
const recursor = subject.createRecursor()

if (formatter.increaseIndent && maxDepth > 0 && indent.level === maxDepth) {
if (formatter.increaseIndent && maxDepth > 0 && indent.level === maxDepth && !renderDiffWithUnlimitedDepth) {
const isEmpty = recursor() === null
let formatted = !isEmpty && typeof formatter.maxDepth === 'function'
? formatter.maxDepth()
Expand Down