Add doscstrings and move stringifyValues into its own function for reuse

This commit is contained in:
Aria 2025-08-05 22:29:59 -05:00
parent 23e5358ae4
commit de15d79edf
4 changed files with 32 additions and 10 deletions

View file

@ -487,3 +487,13 @@ export function getCurrentKeyboardState() {
// }
// return lcm((x * y) / gcd(x, y), ...z);
// };
// Takes values -- typically derived from events, i.e. `hap`s -- and renders them
// into a readable format
export function stringifyValues(value, compact = false) {
return typeof value === 'object'
? compact
? JSON.stringify(value).slice(1, -1).replaceAll('"', '').replaceAll(',', ' ')
: JSON.stringify(value)
: value;
}