Skip to content

Commit f458bc8

Browse files
authored
Bump dependencies (#70)
1 parent bdd5040 commit f458bc8

6 files changed

Lines changed: 3111 additions & 2418 deletions

File tree

demo/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global document */
12
import shortenUrl from '../index.js';
23
import {urls} from '../fixtures/urls.js';
34

index.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global document */
2+
/* eslint-disable unicorn/better-regex */
13
import reservedNames from 'github-reserved-names/reserved-names.json' with { type: 'json' };
24

35
const patchDiffRegex = /[.](patch|diff)$/;
@@ -72,6 +74,7 @@ function joinValues(array, delimiter = '/') {
7274
* @param href {string}
7375
* @param currentUrl {string}
7476
*/
77+
/* eslint-disable complexity */
7578
function shortenRepoUrl(href, currentUrl = 'https://github.com') {
7679
if (!href) {
7780
return;
@@ -275,6 +278,7 @@ function shortenRepoUrl(href, currentUrl = 'https://github.com') {
275278
// Drop leading and trailing slash of relative path
276279
return pathname.replaceAll(/^[/]|[/]$/g, '') + url.search + hash + query;
277280
}
281+
/* eslint-enable complexity */
278282

279283
/**
280284
* Without this, <a>%%</a> would throw an error
@@ -317,19 +321,15 @@ export function applyToLink(a, currentUrl) {
317321
) {
318322
const url = a.textContent;
319323
const shortened = shortenRepoUrl(url, currentUrl);
320-
a.replaceChildren(
321-
...shortened.split(
322-
/<code>([^<]+)<\/code>/g,
323-
).map((part, i) => {
324-
if (i % 2 === 0) {
325-
return part;
326-
}
327-
328-
const codeElement = document.createElement('code');
329-
codeElement.textContent = part;
330-
return codeElement;
331-
}),
332-
);
324+
a.replaceChildren(...shortened.split(/<code>([^<]+)<\/code>/g).map((part, i) => {
325+
if (i % 2 === 0) {
326+
return part;
327+
}
328+
329+
const codeElement = document.createElement('code');
330+
codeElement.textContent = part;
331+
return codeElement;
332+
}));
333333
return true;
334334
}
335335

index.test-d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import {expectType} from 'tsd';
22
import {applyToLink} from './index.js';
33

4-
expectType<void>(
5-
applyToLink(document.createElement('a'), 'https://bettersite.com'),
6-
);
4+
expectType<void>(applyToLink(document.createElement('a'), 'https://bettersite.com'));

index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* global document */
12
import {test, expect} from 'vitest';
23
import {Window} from 'happy-dom';
34
import {urls} from './fixtures/urls.js';

0 commit comments

Comments
 (0)