2.0.0 • Published 7 years ago

tweet-truncate v2.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

tweet-truncate

Chops text down to size for Twitter using ellipses. You give it the text and any urls you want to include in the tweet, and it gives you back something that will fit.

Installation

npm install tweet-truncate

Usage

var truncateToTweet = require('tweet-truncate');
console.log(truncateToTweet({
  maxTweetMessageLength: 140,
  text: 'Normally, this text would not need to be truncated. However! A URL must be included in the tweet. URL stands for Universal Resource Locator.',
  urlsToAdd: [
    'http://smidgeo.com/plan'
  ]
});

This would print out:

Normally, this text would not need to be truncated. However! A URL must be included in the tweet. URL stands for Uni… http://smidgeo.com/plan

maxTweetMessageLength defaults to 280 now.

Tests

Run tests with make test.

License

MIT.

2.0.0

7 years ago

1.1.1

9 years ago

1.1.0

10 years ago

1.0.0

10 years ago