This breaks my use case
function shorten(text, length)
const t = document.createElement('input')
t.maxlength = length
t.value = text
return t.value
}