Only put nbsp before last token in msg body if token is <12 chars

This commit is contained in:
Scott Nonnenberg 2019-02-22 10:55:37 -08:00
parent ba501a6df6
commit eb7ad48951

View file

@ -458,11 +458,10 @@
const nbsp = '\xa0';
const regex = /(\S)( +)(\S+\s*)$/;
return text.replace(regex, (match, start, spaces, end) => {
const newSpaces = _.reduce(
spaces,
accumulator => accumulator + nbsp,
''
);
const newSpaces =
end.length < 12
? _.reduce(spaces, accumulator => accumulator + nbsp, '')
: spaces;
return `${start}${newSpaces}${end}`;
});
},