Skip to content

Commit

Permalink
update: use || to replace ??
Browse files Browse the repository at this point in the history
update: use `import type` to import types
  • Loading branch information
BANKA2017 committed Jan 20, 2024
1 parent 509c961 commit b0354a7
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kdwnil/translator-utils",
"private": true,
"version": "0.0.2-alpha.25",
"version": "0.0.2-alpha.26",
"description": "translate utils",
"homepage": "https://github.com/BANKA2017/translator-utils",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/translator-utils-axios-helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class AxiosRequest {
options.timeout = 30000
}

const validPostRequest = (options?.method ?? '').toLowerCase() === 'post' && postData
const validPostRequest = (options?.method || '').toLowerCase() === 'post' && postData
if (!options.headers) {
options.headers = {}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/translator-utils-axios-helper/index.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import https from 'node:https'

class AxiosRequest {
requestHandle(url, postData, options = {}) {
const HTTPS_PROXY = process.env.https_proxy ?? process.env.HTTPS_PROXY ?? ''
const HTTPS_PROXY = process.env.https_proxy || process.env.HTTPS_PROXY || ''

if (HTTPS_PROXY && HttpsProxyAgent) {
options.agent = new HttpsProxyAgent({ proxy: HTTPS_PROXY })
Expand All @@ -19,7 +19,7 @@ class AxiosRequest {
options.headers['user-agent'] = defaultUA
}

const validPostRequest = (options?.method ?? '').toLowerCase() === 'post' && postData
const validPostRequest = (options?.method || '').toLowerCase() === 'post' && postData
if (!options.headers['content-type']) {
options.headers['content-type'] = 'application/x-www-form-urlencoded'
}
Expand Down
2 changes: 1 addition & 1 deletion src/source/deepl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TranslatorModuleFunction } from '../types.js'
import type { TranslatorModuleFunction } from '../types.js'
import { SupportedLanguage } from '../misc.js'
import axiosFetch from 'translator-utils-axios-helper'
import cryptoHandle from 'translator-utils-crypto'
Expand Down
2 changes: 1 addition & 1 deletion src/source/google.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TTSModuleFunction, TranslatorModuleFunction } from '../types.js'
import type { TTSModuleFunction, TranslatorModuleFunction } from '../types.js'
import { SupportedLanguage } from '../misc.js'
import axiosFetch from 'translator-utils-axios-helper'
import { GOOGLE_LANGUAGE } from '../language.js'
Expand Down
2 changes: 1 addition & 1 deletion src/source/sogou.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TTSModuleFunction, TranslatorModuleFunction } from '../types.js'
import type { TTSModuleFunction, TranslatorModuleFunction } from '../types.js'
import { SupportedLanguage, buffer_to_base64 } from '../misc.js'
import axiosFetch from 'translator-utils-axios-helper'
import cryptoHandle from 'translator-utils-crypto'
Expand Down
2 changes: 1 addition & 1 deletion src/source/yandex.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TranslatorModuleFunction } from '../types.js'
import type { TranslatorModuleFunction } from '../types.js'
import { SupportedLanguage, generateUUID } from '../misc.js'
import axiosFetch from 'translator-utils-axios-helper'
import { YANDEX_LANGUAGE } from '../language.js'
Expand Down

0 comments on commit b0354a7

Please sign in to comment.