0.2.5 • Published 5 years ago
generic-diff-context v0.2.5
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-diffor 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 propertiesbeforeandafterto select them separately. You can also use the0property instead ofbefore, and1, instead ofafter, so an array of two numbers will work.finalLf: (bool) (default: false; default inunifiedmode: 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-diffing a and b.
Usage
see test/usage.demo.js and the tests
License
ISC