Skip to content

Commit 3a637ed

Browse files
committed
build(deps-dev): bump tslint from 5.20.1 to 6.0.0
1 parent acca437 commit 3a637ed

File tree

3 files changed

+38
-36
lines changed

3 files changed

+38
-36
lines changed

package-lock.json

+7-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"standard-version": "7.1.0",
5050
"ts-jest": "25.2.1",
5151
"ts-node": "8.6.2",
52-
"tslint": "5.20.1",
52+
"tslint": "6.0.0",
5353
"typescript": "3.8.3"
5454
},
5555
"dependencies": {},

src/index.ts

+30-17
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ export interface BaseCompareOptions<TLeft, TRight> {
55
onMatch?: (left: TLeft, right: TRight) => void;
66
}
77

8-
export interface CompareListsOptions<TLeft, TRight> extends BaseCompareOptions<TLeft, TRight> {
8+
export interface CompareListsOptions<TLeft, TRight>
9+
extends BaseCompareOptions<TLeft, TRight> {
910
left: Iterable<TLeft>;
1011
right: Iterable<TRight>;
1112
}
1213

1314
export interface CompareListsReport<TLeft, TRight> {
1415
missingInLeft: TRight[];
1516
missingInRight: TLeft[];
16-
matches: Array<[TLeft, TRight]>;
17+
matches: [TLeft, TRight][];
1718
}
1819

1920
export function compareLists<TLeft, TRight>(
@@ -33,7 +34,13 @@ export function compareLists<TLeft, TRight>(
3334
const leftIterator = options.left[Symbol.iterator]();
3435
const rightIterator = options.right[Symbol.iterator]();
3536

36-
const { compare, returnReport, onMissingInLeft, onMissingInRight, onMatch } = options;
37+
const {
38+
compare,
39+
returnReport,
40+
onMissingInLeft,
41+
onMissingInRight,
42+
onMatch
43+
} = options;
3744

3845
const result = compareIterators({
3946
left: leftIterator,
@@ -48,7 +55,8 @@ export function compareLists<TLeft, TRight>(
4855
return result;
4956
}
5057

51-
export interface CompareIteratorsOptions<TLeft, TRight> extends BaseCompareOptions<TLeft, TRight> {
58+
export interface CompareIteratorsOptions<TLeft, TRight>
59+
extends BaseCompareOptions<TLeft, TRight> {
5260
left: Iterator<TLeft>;
5361
right: Iterator<TRight>;
5462
}
@@ -69,23 +77,27 @@ export function compareIterators<TLeft, TRight>(
6977
): void | CompareListsReport<TLeft, TRight> {
7078
const leftIterator = options.left;
7179
const rightIterator = options.right;
72-
const { compare, onMissingInLeft, onMissingInRight, onMatch, returnReport } = options;
80+
const {
81+
compare,
82+
onMissingInLeft,
83+
onMissingInRight,
84+
onMatch,
85+
returnReport
86+
} = options;
7387

74-
const result = (
75-
returnReport ?
76-
{
88+
const result = returnReport
89+
? ({
7790
missingInLeft: [],
7891
missingInRight: [],
7992
matches: []
80-
} as CompareListsReport<TLeft, TRight> :
81-
undefined
82-
);
93+
} as CompareListsReport<TLeft, TRight>)
94+
: undefined;
8395

8496
let left: IteratorResult<TLeft>;
8597
let right: IteratorResult<TRight>;
8698

87-
const nextLeft = () => left = leftIterator.next();
88-
const nextRight = () => right = rightIterator.next();
99+
const nextLeft = () => (left = leftIterator.next());
100+
const nextRight = () => (right = rightIterator.next());
89101

90102
const handleMissingInLeft = () => {
91103
if (returnReport) {
@@ -122,10 +134,11 @@ export function compareIterators<TLeft, TRight>(
122134
nextRight();
123135

124136
while (!left.done || !right.done) {
125-
const compareResult =
126-
left.done ? 1 :
127-
right.done ? -1 :
128-
compare(left.value, right.value);
137+
const compareResult = left.done
138+
? 1
139+
: right.done
140+
? -1
141+
: compare(left.value, right.value);
129142

130143
if (compareResult < 0) {
131144
handleMissingInRight();

0 commit comments

Comments
 (0)