Skip to content

Commit 70f5f62

Browse files
dmsnellGrosSacASac
andcommitted
Javascript: Add iterable instance to Diff for destructuring.
Resolves google#39 It can be useful to extract `Diff` elements using destructuring assignment. For example: ```js const a = dmp.diff_main('abc', 'ab123c', false); const [eq, str] = a[0]; ``` Because the `Diff` object is not an array, however, this is not possible, even though it acts like an array. In this patch a new `Symbol.iterator` method is added to the `Diff` class so that this pattern can be used. Props: @JackuB, @GrosSacASac, @TheSpyder Co-authored-by: Cyril Walle <[email protected]>
1 parent 5337709 commit 70f5f62

File tree

4 files changed

+41
-13
lines changed

4 files changed

+41
-13
lines changed

0 commit comments

Comments
 (0)