mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
#1781 Fix /len and unescape for non-string arguments
This commit is contained in:
@ -649,7 +649,19 @@ function lenValuesCallback(value) {
|
||||
} catch {
|
||||
// could not parse
|
||||
}
|
||||
return parsedValue.length;
|
||||
if (Array.isArray(parsedValue)) {
|
||||
return parsedValue.length;
|
||||
}
|
||||
switch (typeof parsedValue) {
|
||||
case 'string':
|
||||
return parsedValue.length;
|
||||
case 'object':
|
||||
return Object.keys(parsedValue).length;
|
||||
case 'number':
|
||||
return String(parsedValue).length;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function randValuesCallback(from, to, args) {
|
||||
|
Reference in New Issue
Block a user