@createiq/htmldiff 1.2.0-beta.5 → 1.2.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@createiq/htmldiff",
3
- "version": "1.2.0-beta.5",
3
+ "version": "1.2.0-beta.6",
4
4
  "description": "TypeScript port of htmldiff.net",
5
5
  "type": "module",
6
6
  "author": "Mathew Mannion <mathew.mannion@linklaters.com>",
package/src/HtmlDiff.ts CHANGED
@@ -249,8 +249,20 @@ export default class HtmlDiff {
249
249
  this.newText = newText
250
250
  }
251
251
 
252
- static execute(oldText: string, newText: string): string {
253
- return new HtmlDiff(oldText, newText).build()
252
+ static execute(oldText: string, newText: string, options: AnalyzeOptions = {}): string {
253
+ const inner = new HtmlDiff(oldText, newText)
254
+ if (options.blockExpressions) {
255
+ for (const expr of options.blockExpressions) inner.addBlockExpression(expr)
256
+ }
257
+ if (options.repeatingWordsAccuracy !== undefined) inner.repeatingWordsAccuracy = options.repeatingWordsAccuracy
258
+ if (options.orphanMatchThreshold !== undefined) inner.orphanMatchThreshold = options.orphanMatchThreshold
259
+ if (options.ignoreWhitespaceDifferences !== undefined) {
260
+ inner.ignoreWhitespaceDifferences = options.ignoreWhitespaceDifferences
261
+ }
262
+ // `useProjections` is intentionally NOT plumbed here — the 2-way
263
+ // path's build() runs its own heuristic. Pass via `analyze` if a
264
+ // caller needs to force it.
265
+ return inner.build()
254
266
  }
255
267
 
256
268
  /**