just-prune
v2.2.0
Published
prune a string with whole words and a custom suffix
Downloads
202
Maintainers
Readme
just-prune
Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.
npm install just-prune
yarn add just-prune
Prune a string with whole words and a custom suffix
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)'