bump jest and make tests pass

This commit is contained in:
Louis Hache
2020-11-13 19:11:55 +01:00
parent d28dc26fa3
commit 4f58d166b7
5769 changed files with 856618 additions and 394571 deletions
+5 -7
View File
@@ -28,15 +28,14 @@ To add this package as a dependency of a project, do either of the following:
To use `diff` as the name of the default export from this package, do either of the following:
- `var diff = require('diff-sequences'); // CommonJS modules`
- `var diff = require('diff-sequences').default; // CommonJS modules`
- `import diff from 'diff-sequences'; // ECMAScript modules`
Call `diff` with the **lengths** of sequences and your **callback** functions:
```js
/* eslint-disable no-var */
var a = ['a', 'b', 'c', 'a', 'b', 'b', 'a'];
var b = ['c', 'b', 'a', 'b', 'a', 'c'];
const a = ['a', 'b', 'c', 'a', 'b', 'b', 'a'];
const b = ['c', 'b', 'a', 'b', 'a', 'c'];
function isCommon(aIndex, bIndex) {
return a[aIndex] === b[bIndex];
@@ -73,10 +72,9 @@ Various packages which implement the Myers algorithm will **always agree** on th
## Example of callback functions to count common items
```js
/* eslint-disable no-var */
// Return length of longest common subsequence according to === operator.
function countCommonItems(a, b) {
var n = 0;
let n = 0;
function isCommon(aIndex, bIndex) {
return a[aIndex] === b[bIndex];
}
@@ -89,7 +87,7 @@ function countCommonItems(a, b) {
return n;
}
var commonLength = countCommonItems(
const commonLength = countCommonItems(
['a', 'b', 'c', 'a', 'b', 'b', 'a'],
['c', 'b', 'a', 'b', 'a', 'c'],
);