just-truncate
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

just-truncate

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-truncate
yarn add just-truncate

Truncate a string with a custom suffix

  truncate('when shall we three meet again', 9); // 'when s...'
  truncate('when shall we three meet again', 10, ' (etc)'); // 'when (etc)'
  truncate('when shall we', 15,); // 'when shall we'
  truncate('when shall we', 15, '(more)'); // 'when shall we'
  truncate('when shall we', 10, ' (etc etc etc)'); // ' (etc etc etc)'

Dependents (3)

Package Sidebar

Install

npm i just-truncate

Weekly Downloads

1,953

Version

2.2.0

License

MIT

Unpacked Size

4.86 kB

Total Files

9

Last publish

Collaborators

  • angus-c