Skip to content

Suggestion: expose fbDiff #15

Closed
chadkirby opened this Issue Nov 17, 2012 · 0 comments

2 participants

@chadkirby

Hi, thanks for the library. One suggestion is to expose fbDiff in module.exports. E.g.,

return {
  fbDiff: fbDiff,
  removeEmpty: removeEmpty,
  diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
  ...

That way, we can define our own tokenizers. E.g., (in coffeescript)

JSdiff = require 'diff'
PatDiff = new JSdiff.fbDiff(true);
PatDiff.tokenize = (value) -> JSdiff.removeEmpty(value.split(/(\s+)/));
...
PatDiff.diff @body, @body.replace(pattern, replacement)
@kpdecker kpdecker added a commit that closed this issue Jan 6, 2013
@kpdecker Expose Diff object
Fixes #15
1f4bf7a
@kpdecker kpdecker closed this in 1f4bf7a Jan 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.