trunc-text

truncate text by length, doesn't cut words

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
trunc-text
1601.0.28 years ago8 years agoMinified + gzip package size for trunc-text in KB

Readme

trunc-text
Build Status
truncate text by length, doesn't cut words
install
using npm.
npm install -S trunc-text
features
  • fast
  • truncates by complete words, not just by characters
trunc(text, limit)
Returns the result of truncating the provided text by limit.

limit

Maximum amount of text characters allowed. When the limit is reached, the algorithm will trace back to the last word separator and trim the rest into a glyph.
related
license
MIT