truncator-js
v0.0.4
Published
Truncate text to the nearest word of a limit
Downloads
8
Readme
truncator-js
Truncate text to the nearest word of a limit
Install
With yarn:
$ yarn add truncator-js
With npm:
$ npm install --save truncator-js
Usage
const truncate = require('truncator-js');
// The function takes two arguments.
// The first is the selector you want to truncate using a '.classname' string.
// The second is the character limit that you wish to truncate on.
// truncate(selector, charLimit)
// Example
truncate('div.shortened', 100);