#1781 Fix /len and unescape for non-string arguments

This commit is contained in:
Cohee
2024-02-03 02:06:49 +02:00
parent 37d94a4331
commit 07677584c4
2 changed files with 30 additions and 13 deletions

View File

@ -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) {