Closed mac-chaffee closed 3 years ago
metadata-helpers relies on https://www.npmjs.com/package/truncate, but that utility is already provided by lodash: https://lodash.com/docs/4.17.15#truncate
Additionally, node-truncate has an extra behavior where it won't truncate URLs no matter how long they are, which users likely don't expect: https://github.com/FGRibreau/node-truncate/blob/a92d6b66f5a71c33e52484862ed069fa12411b24/truncate.js#L12
There is a very slight difference with lodash's truncate: it will replace the last character with "…" rather than appending it, so I had to update the test, but I don't anticipate too many people are relying on that behavior ;)
I originally added truncate to keep URLs there but it's true an URL can be so long, so let's merge the PR 🙂
truncate
metadata-helpers relies on https://www.npmjs.com/package/truncate, but that utility is already provided by lodash: https://lodash.com/docs/4.17.15#truncate
Additionally, node-truncate has an extra behavior where it won't truncate URLs no matter how long they are, which users likely don't expect: https://github.com/FGRibreau/node-truncate/blob/a92d6b66f5a71c33e52484862ed069fa12411b24/truncate.js#L12
There is a very slight difference with lodash's truncate: it will replace the last character with "…" rather than appending it, so I had to update the test, but I don't anticipate too many people are relying on that behavior ;)