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
+1 -1
View File
@@ -1,4 +1,4 @@
import { replaceBioSymbols } from './common'; import { replaceBioSymbols } from './base/string';
import { useAuthStore } from '../../stores'; import { useAuthStore } from '../../stores';
/** /**
+48 -1
View File
@@ -99,11 +99,58 @@ function changeLogRemoveLinks(text) {
return text.replace(/([^!])\[[^\]]+\]\([^)]+\)/g, '$1'); 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 { export {
escapeTag, escapeTag,
escapeTagRecursive, escapeTagRecursive,
textToHex, textToHex,
commaNumber, commaNumber,
localeIncludes, localeIncludes,
changeLogRemoveLinks changeLogRemoveLinks,
replaceBioSymbols
}; };
+1 -47
View File
@@ -10,9 +10,9 @@ import {
useSearchStore, useSearchStore,
useWorldStore useWorldStore
} from '../../stores'; } from '../../stores';
import { escapeTag, replaceBioSymbols } from './base/string';
import { AppDebug } from '../../service/appConfig.js'; import { AppDebug } from '../../service/appConfig.js';
import { compareUnityVersion } from './avatar'; import { compareUnityVersion } from './avatar';
import { escapeTag } from './base/string';
import { miscRequest } from '../../api'; import { miscRequest } from '../../api';
/** /**
@@ -345,52 +345,6 @@ function buildTreeData(json) {
return node; 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 * @param {string} link
+1 -1
View File
@@ -1,5 +1,5 @@
import { instanceRequest } from '../../api'; import { instanceRequest } from '../../api';
import { parseLocation } from './location'; import { parseLocation } from './locationParser';
/** /**
* *