prune a string with whole words and a custom suffix
npm install just-prunePart of a library of zero-dependency npm modules that do just do one thing.
Guilt-free utilities for every occasion.
``shell`
npm install just-prune`shell`
yarn add just-prune
Prune a string with whole words and a custom suffix
`js``
prune('when shall we three meet again', 7); // 'when...'
prune('when shall we three meet again', 7, ' (more)'; // 'when (more)'
prune('when shall we', 15,); // 'when shall we'
prune('when shall we', 15, ' (etc)'); // 'when shall we'
prune('when shall we', 7, ' (more)'); // ' (more)'