Remove circular dependencies between utility functions

This commit is contained in:
pa
2026-02-12 15:24:11 +09:00
parent 5725255e4b
commit 4039698c71
4 changed files with 51 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
import { replaceBioSymbols } from './common';
import { replaceBioSymbols } from './base/string';
import { useAuthStore } from '../../stores';
/**

View File

@@ -99,11 +99,58 @@ function changeLogRemoveLinks(text) {
return text.replace(/([^!])\[[^\]]+\]\([^)]+\)/g, '$1');
}
/**
*
* @param {string} text
* @returns {string}
*/
function replaceBioSymbols(text) {
if (typeof text !== 'string') {
return '';
}
const symbolList = {
'@': '',
'#': '',
$: '',
'%': '',
'&': '',
'=': '',
'+': '',
'/': '',
'\\': '',
';': ';',
':': '˸',
',': '',
'?': '',
'!': 'ǃ',
'"': '',
'<': '≺',
'>': '≻',
'.': '',
'^': '',
'{': '',
'}': '',
'[': '',
']': '',
'(': '',
')': '',
'|': '',
'*': ''
};
let newText = text;
for (const key in symbolList) {
const regex = new RegExp(symbolList[key], 'g');
newText = newText.replace(regex, key);
}
return newText.replace(/ {1,}/g, ' ').trimRight();
}
export {
escapeTag,
escapeTagRecursive,
textToHex,
commaNumber,
localeIncludes,
changeLogRemoveLinks
changeLogRemoveLinks,
replaceBioSymbols
};

View File

@@ -10,9 +10,9 @@ import {
useSearchStore,
useWorldStore
} from '../../stores';
import { escapeTag, replaceBioSymbols } from './base/string';
import { AppDebug } from '../../service/appConfig.js';
import { compareUnityVersion } from './avatar';
import { escapeTag } from './base/string';
import { miscRequest } from '../../api';
/**
@@ -345,52 +345,6 @@ function buildTreeData(json) {
return node;
}
/**
*
* @param {string} text
* @returns {string}
*/
function replaceBioSymbols(text) {
if (typeof text !== 'string') {
return '';
}
const symbolList = {
'@': '',
'#': '',
$: '',
'%': '',
'&': '',
'=': '',
'+': '',
'/': '',
'\\': '',
';': ';',
':': '˸',
',': '',
'?': '',
'!': 'ǃ',
'"': '',
'<': '≺',
'>': '≻',
'.': '',
'^': '',
'{': '',
'}': '',
'[': '',
']': '',
'(': '',
')': '',
'|': '',
'*': ''
};
let newText = text;
for (const key in symbolList) {
const regex = new RegExp(symbolList[key], 'g');
newText = newText.replace(regex, key);
}
return newText.replace(/ {1,}/g, ' ').trimRight();
}
/**
*
* @param {string} link

View File

@@ -1,5 +1,5 @@
import { instanceRequest } from '../../api';
import { parseLocation } from './location';
import { parseLocation } from './locationParser';
/**
*