Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

JavaScript: Diff is not iterable #39

@JackuB

Description

@JackuB

There was a change in JS version cd60d24#diff-5270d640a6c9c1b0590326b029d71ec8R76 from plain Array to a diff_match_patch.Diff Object that's trying to emulate Array.

The new object is not iterable, which messes up for example with Array destructing:

const a = dmp.diff_main('abc', 'ab123c', false);
const [eq, str] = a[0]; // => Uncaught TypeError: a[0] is not iterable
  1. was this change necessary? Tested that plain array works just fine with current version
  2. To really emulate array here, adding [Symbol.iterator] would do the trick, but its browser support is questionable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions