Skip to content

API messed up 1.0.0 -> 1.0.3 #14

@bebbi

Description

@bebbi

1.0.0 worked.
In 1.0.3, the API is somehow messed up. The test harness does not detect it.

// that's what it should be but is not:
var a = [[DIFF_EQUAL, 'ab'], [DIFF_INSERT, '123'], [DIFF_EQUAL, 'c']]
var b = dmp.diff_main('abc', 'ab123c', false)
// Instead it's a strange object
console.log(b)
[ { '0': 0, '1': 'ab' },
  { '0': 1, '1': '123' },
  { '0': 0, '1': 'c' } ]
console.log(Array.isArray(a[0])) // true
console.log(Array.isArray(b[0])) // false
console.log(b)
assertEquivalent(a, b); // yes, equivalent

And it breaks ES6 clients:

const [eq, str] = a[0]  // works
const [eq, str] = b[0]  // breaks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions