generic-diff-context
v0.2.5
Published
Filter reports from `generic-diff` or compatible modules to give changes with optional context.
Downloads
37
Readme
generic-diff-context
Filter reports from generic-diff
or compatible modules to give changes with
optional context.
API
genDiffCtx(report[, opts])
report
: the one generated bygeneric-diff
or a compatible module.opts
: config objectmergePairs
: (bool) (default:false
) Whether pairs of deletion and addition shall be merged.unified
: (number | object | bool) (default:false
) With number(s) given, return a unified diff, i.e. array of changes, each change being an array of lines changed. The number sets how much context = how many unchanged items to include on both sides of the change(s). Give an object with number propertiesbefore
andafter
to select them separately. You can also use the0
property instead ofbefore
, and1
, instead ofafter
, so an array of two numbers will work.finalLf
: (bool) (default: false; default inunified
mode: true) Whether to report the trailing newline as GNU diff does: If the last line has a newline at its end, omit it, otherwise add a message that there was no newline at end of input.
genDiffCtx(a, b[, opts])
Like above, but generate the report by generic-diff
ing a
and b
.
Usage
see test/usage.demo.js and the tests
License
ISC