1.14.3 • Published 7 years ago

twitter-text-tweetlength-js v1.14.3

Weekly downloads
15
License
-
Repository
github
Last release
7 years ago

Build Status npm Bower

twitter-text-tweetlength-js

This library is a subset of official twitter-text library dedicated to counting tweet length. Autolinking, extraction and other officially-implemented features were all removed.

NPM Users

Install it with: npm install twitter-text-tweetlength-js

Usage

The twttr.txt namespace is exported, making it available as such:

Tweet character count example

var twitter = require('twitter-text-tweetlength-js');
twitter.getTweetLength('test.com'); // => 23

getTweetLength returns the computed length of a tweet after taking into consideration t.co URL shortening and non UTF-16 characters

Remaining character count example

var tweet = "This is a test tweet";
var remainingCharacters = 140 - twttr.txt.getTweetLength(tweet);