-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Isolated test case as requested in avajs/ava#1521
If you append an item to an array and diff:
var concordance = require('concordance');
const orig = [
'foo',
'bar',
'fizz',
'buzz'
];
const copy = Array.from(orig);
copy.push('hi')
concordance.diff(orig, copy);
You get neat output:
[
'foo',
'bar',
'fizz',
'buzz',
+ 'hi',
]
However if you insert anywhere else and diff:
var concordance = require('concordance');
const orig = [
'foo',
'bar',
'fizz',
'buzz'
];
const copy = Array.from(orig);
copy.unshift('hi')
concordance.diff(orig, copy);
The output is quite hard to follow after the inserted item:
[
- 'foo',
+ 'hi',
- 'bar',
+ 'foo',
- 'fizz',
+ 'bar',
- 'buzz',
+ 'fizz',
+ 'buzz',
]
sindresorhus, daniel-wer, forivall, Treora and RandomByte
Metadata
Metadata
Assignees
Labels
No labels