truncate-words
v1.0.0
Published
Truncates a string after a certain number of words.
Downloads
228
Readme
truncate-words
Truncates a string after a certain number of words.
const truncateWords = require('truncate-words')
const a = 'The nuclear deal is based on lies.'
truncateWords(a, 4) // 'The nuclear deal is [...]'
This is similar to the truncatewords filter found in Django.