Add doscstrings and move stringifyValues into its own function for reuse
This commit is contained in:
parent
23e5358ae4
commit
de15d79edf
4 changed files with 32 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue