mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add util for trim v1
This commit is contained in:
10
src/util.js
10
src/util.js
@ -458,6 +458,15 @@ function excludeKeysByYaml(obj, yamlString) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes trailing slash and /v1 from a string.
|
||||
* @param {string} str Input string
|
||||
* @returns {string} Trimmed string
|
||||
*/
|
||||
function trimV1(str) {
|
||||
return String(str ?? '').replace(/\/$/, '').replace(/\/v1$/, '');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getConfig,
|
||||
getConfigValue,
|
||||
@ -481,4 +490,5 @@ module.exports = {
|
||||
getHexString,
|
||||
mergeObjectWithYaml,
|
||||
excludeKeysByYaml,
|
||||
trimV1,
|
||||
};
|
||||
|
Reference in New Issue
Block a user