Skip to content

Commit 8b0195b

Browse files
committed
🎨 prettier formatting again.
1 parent 7f52025 commit 8b0195b

320 files changed

Lines changed: 2311 additions & 1842 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/publish.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: deno task lint-docs
2929

3030
- name: Format
31-
run: deno task format
31+
run: deno task format-check
3232

3333
- name: Test
3434
run: deno task test-coverage

‎.zed/settings.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
"deno",
88
"!typescript-language-server",
99
"!vtsls",
10-
"!eslint",
11-
],
10+
"!eslint"
11+
]
1212
},
1313
"TSX": {
1414
"language_servers": [
1515
"deno",
1616
"!typescript-language-server",
1717
"!vtsls",
18-
"!eslint",
19-
],
18+
"!eslint"
19+
]
2020
},
2121
"TypeScript": {
2222
"language_servers": [
2323
"deno",
2424
"!typescript-language-server",
2525
"!vtsls",
26-
"!eslint",
27-
],
28-
},
26+
"!eslint"
27+
]
28+
}
2929
},
30-
"lsp": { "deno": { "settings": { "deno": { "enable": true } } } },
30+
"lsp": { "deno": { "settings": { "deno": { "enable": true } } } }
3131
}

‎@coven/compare/FlatDifference.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ import type { UpdateDifference } from "./UpdateDifference.ts";
3434
* @see {@linkcode FlatPath}
3535
* @see {@linkcode UpdateDifference}
3636
*/
37-
export type FlatDifference =
38-
& (
39-
| Omit<CreateDifference, "path">
40-
| Omit<DeleteDifference, "path">
41-
| Omit<UpdateDifference, "path">
42-
)
37+
export type FlatDifference = (
38+
| Omit<CreateDifference, "path">
39+
| Omit<DeleteDifference, "path">
40+
| Omit<UpdateDifference, "path">
41+
)
4342
& FlatPath;

‎@coven/compare/compareIterables.ts‎

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,38 @@ import { pathPrepend } from "./pathPrepend.ts";
2626
* @param left Original iterable.
2727
* @returns Curried generator with `left` in context.
2828
*/
29-
export const compareIterables = <LeftItem>(
30-
left: Iterable<LeftItem>,
31-
): CurriedComparison<Iterable<LeftItem>> =>
32-
/**
33-
* Curried {@linkcode compareIterables} with `left` set in context.
34-
*
35-
* @param right New iterable.
36-
* @returns Generator with differences.
37-
*/
38-
(right) =>
39-
iteratorFunctionToIterableIterator(function* (): Generator<Difference> {
40-
const leftIterator = getIterator(left);
41-
const rightIterator = getIterator(right);
29+
export const compareIterables =
30+
<LeftItem>(
31+
left: Iterable<LeftItem>,
32+
): CurriedComparison<Iterable<LeftItem>> =>
33+
/**
34+
* Curried {@linkcode compareIterables} with `left` set in context.
35+
*
36+
* @param right New iterable.
37+
* @returns Generator with differences.
38+
*/
39+
(right) =>
40+
iteratorFunctionToIterableIterator(function* (): Generator<Difference> {
41+
const leftIterator = getIterator(left);
42+
const rightIterator = getIterator(right);
4243

43-
for (
44-
let index = 0,
45-
{ done: leftDone = false, value: leftValue } = leftIterator
46-
.next(),
47-
{ done: rightDone = false, value: rightValue } = rightIterator
48-
.next();
49-
!(leftDone && rightDone);
50-
index += 1,
51-
{ done: leftDone = false, value: leftValue } = leftIterator
52-
.next(),
53-
{ done: rightDone = false, value: rightValue } = rightIterator
54-
.next()
55-
) {
56-
yield* map(pathPrepend(index))(
57-
compare(leftDone ? MISSING_VALUE : leftValue)(
58-
rightDone ? MISSING_VALUE : rightValue,
59-
),
60-
);
61-
}
62-
});
44+
for (
45+
let index = 0,
46+
{ done: leftDone = false, value: leftValue } =
47+
leftIterator.next(),
48+
{ done: rightDone = false, value: rightValue } =
49+
rightIterator.next();
50+
!(leftDone && rightDone);
51+
index += 1,
52+
{ done: leftDone = false, value: leftValue } =
53+
leftIterator.next(),
54+
{ done: rightDone = false, value: rightValue } =
55+
rightIterator.next()
56+
) {
57+
yield* map(pathPrepend(index))(
58+
compare(leftDone ? MISSING_VALUE : leftValue)(
59+
rightDone ? MISSING_VALUE : rightValue,
60+
),
61+
);
62+
}
63+
});

‎@coven/compare/compareObjects.ts‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,19 @@ export const compareObjects = (left: object): CurriedComparison<unknown> => {
2929
const differentiateLeft = differentiate(left);
3030
const isLeftConstructor = is(left.constructor);
3131

32-
return leftIsIterator
33-
/**
34-
* Curried {@linkcode compareObjects} with `left` set in context.
35-
*
36-
* @param right New object.
37-
* @returns Generator with differences.
38-
*/
39-
? (right) =>
40-
isLeft(right)
41-
? EMPTY_ITERABLE_ITERATOR
42-
: (isObject(right) && isLeftConstructor(right.constructor)
43-
? isIterable(right)
44-
? compareIterableLeft
45-
: comparePropertiesLeft
46-
: differentiateLeft)(right as Iterable<unknown>)
47-
: comparePropertiesLeft;
32+
return leftIsIterator ?
33+
/**
34+
* Curried {@linkcode compareObjects} with `left` set in context.
35+
*
36+
* @param right New object.
37+
* @returns Generator with differences.
38+
*/
39+
(right) =>
40+
isLeft(right) ?
41+
EMPTY_ITERABLE_ITERATOR
42+
: (isObject(right) && isLeftConstructor(right.constructor) ?
43+
isIterable(right) ? compareIterableLeft
44+
: comparePropertiesLeft
45+
: differentiateLeft)(right as Iterable<unknown>)
46+
: comparePropertiesLeft;
4847
};

‎@coven/compare/compareProperties.ts‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,22 @@ export const compareProperties = (left: object): CurriedComparison<unknown> => {
4141
* @yields Differences.
4242
*/
4343
return (right) =>
44-
isLeft(right) ? EMPTY_ITERABLE_ITERATOR : isObject(right)
45-
? flat(
44+
isLeft(right) ? EMPTY_ITERABLE_ITERATOR
45+
: isObject(right) ?
46+
flat(
4647
map((key: string | symbol) =>
4748
map(pathPrepend(key))(
4849
compare(
49-
key in left
50-
? left[key as keyof typeof left]
51-
: MISSING_VALUE,
50+
key in left ?
51+
left[key as keyof typeof left]
52+
: MISSING_VALUE,
5253
)(
53-
key in right
54-
? right[key as keyof typeof right]
55-
: MISSING_VALUE,
54+
key in right ?
55+
right[key as keyof typeof right]
56+
: MISSING_VALUE,
5657
),
57-
)
58+
),
5859
)(unique(append(getKeys(right))(ownKeysLeft))),
5960
)
60-
: differentiateLeft(right);
61+
: differentiateLeft(right);
6162
};

‎@coven/compare/differentiate.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ export const differentiate = (left: unknown): CurriedComparison<unknown> => {
5151
* @returns Difference object.
5252
*/
5353
return (right) =>
54-
isLeft(right) ? EMPTY_ITERABLE_ITERATOR : toIterable({
55-
...(right === MISSING_VALUE
56-
? { left, kind: DELETE_KIND }
57-
: left === MISSING_VALUE
58-
? { kind: CREATE_KIND, right }
54+
isLeft(right) ?
55+
EMPTY_ITERABLE_ITERATOR
56+
: toIterable({
57+
...(right === MISSING_VALUE ? { left, kind: DELETE_KIND }
58+
: left === MISSING_VALUE ? { kind: CREATE_KIND, right }
5959
: { left, kind: UPDATE_KIND, right }),
60-
path: EMPTY_ITERABLE_ITERATOR,
61-
});
60+
path: EMPTY_ITERABLE_ITERATOR,
61+
});
6262
};

‎@coven/compare/getKeys.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ export const getKeys = (object: object): IterableIterator<string | symbol> =>
2222
> {
2323
yield* Reflect.ownKeys(object);
2424

25-
hasPrototype(object)
26-
? yield* Reflect.ownKeys(object.prototype)
27-
: undefined;
25+
hasPrototype(object) ?
26+
yield* Reflect.ownKeys(object.prototype)
27+
: undefined;
2828

2929
const constructor = object.constructor;
3030

3131
(
32-
isObjectConstructor(constructor)
33-
|| isFunctionConstructor(constructor)
34-
)
35-
? undefined
36-
: yield* getKeys(constructor);
32+
isObjectConstructor(constructor)
33+
|| isFunctionConstructor(constructor)
34+
) ?
35+
undefined
36+
: yield* getKeys(constructor);
3737
}),
3838
);

‎@coven/compare/pathPrepend.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { setPath } from "./setPath.ts";
1818
*/
1919
export const pathPrepend = (
2020
property: PropertyKey,
21-
): (difference: Difference) => Difference => {
21+
): ((difference: Difference) => Difference) => {
2222
const prependProperty = prepend([property]);
2323

2424
/**

‎@coven/compare/tests/compare.test.ts‎

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ const property1 = "property1";
1414
const property2 = "property2";
1515

1616
Deno.test("Comparing same string yields nothing", () =>
17-
assertEquals(flat(compare("magic")("magic")), EMPTY_ARRAY));
17+
assertEquals(flat(compare("magic")("magic")), EMPTY_ARRAY),
18+
);
1819

1920
Deno.test("Comparing same object yields nothing", () =>
20-
assertEquals(flat(compare(EMPTY_OBJECT)(EMPTY_OBJECT)), EMPTY_ARRAY));
21+
assertEquals(flat(compare(EMPTY_OBJECT)(EMPTY_OBJECT)), EMPTY_ARRAY),
22+
);
2123

2224
Deno.test("Comparing different string yields `UpdateDifference`", () =>
2325
assertEquals(flat(compare("magic")("cat")), [
@@ -27,10 +29,12 @@ Deno.test("Comparing different string yields `UpdateDifference`", () =>
2729
path: [],
2830
right: "cat",
2931
},
30-
]));
32+
]),
33+
);
3134

3235
Deno.test("Comparing equal arrays yields nothing", () =>
33-
assertEquals(flat(compare(["magic"])(["magic"])), EMPTY_ARRAY));
36+
assertEquals(flat(compare(["magic"])(["magic"])), EMPTY_ARRAY),
37+
);
3438

3539
Deno.test("Comparing different arrays yields `UpdateDifference`", () =>
3640
assertEquals(flat(compare(["magic"])(["cat"])), [
@@ -40,13 +44,15 @@ Deno.test("Comparing different arrays yields `UpdateDifference`", () =>
4044
path: [0],
4145
right: "cat",
4246
},
43-
]));
47+
]),
48+
);
4449

4550
Deno.test("Comparing equal objects yields nothing", () =>
4651
assertEquals(
4752
flat(compare({ [property1]: "magic" })({ [property1]: "magic" })),
4853
EMPTY_ARRAY,
49-
));
54+
),
55+
);
5056

5157
Deno.test(
5258
"Comparing objects with different property values yields `UpdateDifference`",
@@ -85,7 +91,8 @@ Deno.test("Comparing array with new items yields `CreateDifference`", () =>
8591
]),
8692
),
8793
[{ kind: CREATE_KIND, path: [1], right: { [property2]: "cat" } }],
88-
));
94+
),
95+
);
8996

9097
Deno.test("Comparing array with less items yields `DeleteDifference`", () =>
9198
assertEquals(
@@ -101,13 +108,16 @@ Deno.test("Comparing array with less items yields `DeleteDifference`", () =>
101108
path: [1],
102109
},
103110
],
104-
));
111+
),
112+
);
105113

106114
Deno.test("Comparing equal Date objects yields nothing", () =>
107-
assertEquals(flat(compare(new Date(0))(new Date(0))), EMPTY_ARRAY));
115+
assertEquals(flat(compare(new Date(0))(new Date(0))), EMPTY_ARRAY),
116+
);
108117

109118
Deno.test("Comparing equal RegExp objects yields nothing", () =>
110-
assertEquals(flat(compare(/coven/gu)(/coven/gu)), EMPTY_ARRAY));
119+
assertEquals(flat(compare(/coven/gu)(/coven/gu)), EMPTY_ARRAY),
120+
);
111121

112122
Deno.test("Comparing equal URL objects yields nothing", () =>
113123
assertEquals(
@@ -117,7 +127,8 @@ Deno.test("Comparing equal URL objects yields nothing", () =>
117127
),
118128
),
119129
EMPTY_ARRAY,
120-
));
130+
),
131+
);
121132

122133
Deno.test("Comparing equal `Error` objects yields nothing", () =>
123134
assertEquals(
@@ -127,7 +138,8 @@ Deno.test("Comparing equal `Error` objects yields nothing", () =>
127138
),
128139
),
129140
EMPTY_ARRAY,
130-
));
141+
),
142+
);
131143

132144
Deno.test("Comparing equal `Map` objects yields nothing", () =>
133145
assertEquals(
@@ -137,13 +149,15 @@ Deno.test("Comparing equal `Map` objects yields nothing", () =>
137149
),
138150
),
139151
EMPTY_ARRAY,
140-
));
152+
),
153+
);
141154

142155
Deno.test("Comparing equal `Set` objects yields nothing", () =>
143156
assertEquals(
144157
flat(compare(new Set(["magic"]))(new Set(["magic"]))),
145158
EMPTY_ARRAY,
146-
));
159+
),
160+
);
147161

148162
Deno.test(
149163
"Comparing left `null` and right object yields `UpdateDifference`",
@@ -247,13 +261,15 @@ Deno.test("Comparing 0 with -0 should yield `UpdateDifference`", () =>
247261
path: [],
248262
right: 0,
249263
},
250-
]));
264+
]),
265+
);
251266

252267
Deno.test("Comparing iterator to itself", () =>
253268
assertEquals(
254269
flat(compare(EMPTY_ITERABLE_ITERATOR)(EMPTY_ITERABLE_ITERATOR)),
255270
[],
256-
));
271+
),
272+
);
257273

258274
Deno.test("Comparing iterator to plain object", () =>
259275
assertEquals(flat(compare(EMPTY_ITERABLE_ITERATOR)(EMPTY_OBJECT)), [
@@ -263,4 +279,5 @@ Deno.test("Comparing iterator to plain object", () =>
263279
path: [],
264280
right: EMPTY_OBJECT,
265281
},
266-
]));
282+
]),
283+
);

0 commit comments

Comments
 (0)