truncate-words

1.0.0 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i truncate-words

    Weekly Downloads

    814

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    108 kB

    Total Files

    6

    Last publish

    Collaborators

    • mvasilkov