Skip to content

Commit 84abf6c

Browse files
committed
style: 💄 run formatter
1 parent 28145d3 commit 84abf6c

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

packages/json-joy/src/util/diff/__tests__/str.spec.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('pfx()', () => {
4242
expect(pfx(combining, combining)).toEqual(2);
4343
expect(pfx(combining + 'llo', combining)).toEqual(2);
4444
expect(pfx('hello' + combining, 'hello' + combining)).toEqual(5 + 2);
45-
45+
4646
// Multiple combining marks
4747
const multiCombining = 'a\u0301\u0302\u0303';
4848
expect(pfx(multiCombining, multiCombining)).toEqual(4);
@@ -134,11 +134,11 @@ describe('sfx()', () => {
134134
test('does not split grapheme clusters at boundaries', () => {
135135
const chef = '👨‍🍳';
136136
const family = '👨‍👩‍👧‍👦';
137-
137+
138138
// Ensure we don't split in the middle of a grapheme cluster
139139
expect(sfx('x' + chef, chef)).toEqual(5); // full chef emoji
140140
expect(sfx('xy' + family, family)).toEqual(11); // full family emoji
141-
141+
142142
// When the suffix is part of a larger grapheme, it should not match partially
143143
expect(sfx('👨‍🍳👩', '👩')).toEqual(2); // Just the woman emoji at end
144144
expect(sfx('text👨‍🍳', '👨‍🍳')).toEqual(5); // Full chef emoji
@@ -445,17 +445,11 @@ describe('diff()', () => {
445445
const family = '👨‍👩‍👧‍👦';
446446
const womanTech = '👩🏽‍💻';
447447
const usFlag = '🇺🇸';
448-
assertPatch(
449-
'Hey ' + chef + ', dinner ready?',
450-
'Hi ' + womanTech + ', code ready?'
451-
);
452-
assertPatch(
453-
family + ' going to ' + usFlag,
454-
family + ' staying home'
455-
);
448+
assertPatch('Hey ' + chef + ', dinner ready?', 'Hi ' + womanTech + ', code ready?');
449+
assertPatch(family + ' going to ' + usFlag, family + ' staying home');
456450
assertPatch(
457451
'The ' + chef + ' from ' + usFlag + ' is amazing',
458-
'A ' + womanTech + ' from ' + usFlag + ' is brilliant'
452+
'A ' + womanTech + ' from ' + usFlag + ' is brilliant',
459453
);
460454
});
461455

@@ -556,22 +550,22 @@ describe('diffEdit()', () => {
556550
const family = '👨‍👩‍👧‍👦';
557551
const womanTech = '👩🏽‍💻';
558552
const usFlag = '🇺🇸';
559-
553+
560554
// Insert grapheme clusters
561555
assertDiffEdit('', chef, '');
562556
assertDiffEdit('Hello ', chef, '');
563557
assertDiffEdit('', chef, ' world');
564558
assertDiffEdit('Hello ', chef, ' world');
565559
assertDiffEdit('Team: ', family, ' rocks!');
566-
560+
567561
// Insert multiple grapheme clusters
568562
assertDiffEdit('', chef + family, '');
569563
assertDiffEdit('Coders: ', womanTech + chef, ' win');
570-
564+
571565
// Insert with flags
572566
assertDiffEdit('Made in ', usFlag, '');
573567
assertDiffEdit('', usFlag, ' USA');
574-
568+
575569
// Combining characters
576570
const combining = 'e\u0301';
577571
assertDiffEdit('caf', combining, '');
@@ -603,14 +597,14 @@ describe('overlap()', () => {
603597
test('handles grapheme clusters', () => {
604598
const chef = '👨‍🍳';
605599
const family = '👨‍👩‍👧‍👦';
606-
600+
607601
// Overlap with grapheme clusters
608602
expect(overlap('hello' + chef, chef + 'world')).toEqual(5);
609603
expect(overlap('abc' + family, family + 'xyz')).toEqual(11);
610-
604+
611605
// No overlap when grapheme differs
612606
expect(overlap('hello' + chef, family + 'world')).toEqual(0);
613-
607+
614608
// Text overlap with grapheme clusters
615609
expect(overlap('prefix' + chef, chef + 'suffix')).toEqual(5);
616610
});
@@ -666,7 +660,7 @@ describe('Unicode edge cases', () => {
666660
assertPatch(`hello ${nfc}`, `hello ${nfd}`);
667661
});
668662

669-
test('handles complex emoji with ZWJ sequences', () => {
663+
test('handles complex emoji with ZWJ sequences', () => {
670664
const chefEmoji = '👨‍🍳'; // chef emoji (man + ZWJ + cooking)
671665
const src = chefEmoji;
672666
const dst = 'chef' + chefEmoji;

packages/json-joy/src/util/diff/str.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,11 @@ export const sfx = (txt1: string, txt2: string): number => {
434434
const boundaryPos = txt1.length - mid - 1;
435435
const code = txt1.charCodeAt(boundaryPos);
436436
const isHighSurrogate = code >= 0xd800 && code <= 0xdbff;
437-
const isCombining =
437+
const isCombining =
438438
code === 0x200d || // ZWJ
439439
(code >= 0xfe00 && code <= 0xfe0f) || // Variation selectors
440440
(code >= 0x0300 && code <= 0x036f); // Combining diacritical marks
441-
441+
442442
if (isHighSurrogate || isCombining) {
443443
// We're splitting a grapheme cluster. Walk backwards to include the full cluster.
444444
mid--;
@@ -447,7 +447,7 @@ export const sfx = (txt1: string, txt2: string): number => {
447447
if (pos < 0) break;
448448
const prevCode = txt1.charCodeAt(pos);
449449
const isPrevHighSurrogate = prevCode >= 0xd800 && prevCode <= 0xdbff;
450-
const isPrevCombining =
450+
const isPrevCombining =
451451
prevCode === 0x200d ||
452452
(prevCode >= 0xfe00 && prevCode <= 0xfe0f) ||
453453
(prevCode >= 0x0300 && prevCode <= 0x036f);

0 commit comments

Comments
 (0)