feat: remove unclean require in core

This commit is contained in:
DIYgod
2024-03-02 03:50:42 +08:00
parent a2a3e1b58b
commit 91e6fe3d1a
3 changed files with 8 additions and 4 deletions
+6 -2
View File
@@ -1,7 +1,6 @@
import { describe, expect, it, jest, afterEach, afterAll } from '@jest/globals';
import supertest from 'supertest';
import Parser from 'rss-parser';
import querystring from 'query-string';
import type { serve } from '@hono/node-server';
const parser = new Parser();
@@ -127,7 +126,12 @@ const testAntiHotlink = async (path, expectObj, query?: string | Record<string,
let queryStr;
if (query) {
queryStr = typeof query === 'string' ? query : querystring.stringify(query);
queryStr =
typeof query === 'string'
? query
: Object.entries(query)
.map(([key, value]) => `${key}=${value}`)
.join('&');
}
path = path + (queryStr ? `?${queryStr}` : '');
+1 -1
View File
@@ -1,5 +1,5 @@
import { parseDate } from '@/utils/parse-date';
const title = require('title');
import title from 'title';
// convert a string into title case
const toTitleCase = (str: string) => title(str);
+1 -1
View File
@@ -1,4 +1,4 @@
const assert = require('assert').strict;
import { strict as assert } from 'assert';
const millisInAnHour = 60 * 60 * 1000;
const serverTimezone = -new Date().getTimezoneOffset() / 60;