https://github.com/trstringer/tweetify
:bird: Node.js module that formats text to tweet
https://github.com/trstringer/tweetify
Last synced: 10 months ago
JSON representation
:bird: Node.js module that formats text to tweet
- Host: GitHub
- URL: https://github.com/trstringer/tweetify
- Owner: trstringer
- Created: 2015-10-23T00:41:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-30T00:10:22.000Z (about 10 years ago)
- Last Synced: 2024-10-30T00:36:25.494Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 0 Bytes
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Tweetify
*The tweet-formatting module to make it easy*
## Install
```
npm install tweetify
```
## Usage
```javascript
var tweetify = require('tweetify');
var tweet = {
text: 'this is my really long tweet that i want the ENTIRE world to read no matter what if you know what i mean and i think you know exactly what i mean every single time',
//
// (optional) allows you to specify
// how the tweet should be prefixed. i.e. if you want
// '{Blog Post}: ' in front of your tweet, the below
// spec will give you that
prefix: {
container: 'curley-brackets', // or 'brackets' for []
text: 'Blog Post',
divider: ': ' // other example... ' - ', ' :: ', etc.
},
//
// (optional)
hashtags: ['javascript', 'node'], // don't need a prefixing '#'
//
// (optional) if you only want a single tweet (truncated if too many
// chars) then either don't defined 'wrap' or set it to
// false. but if you want all of the text to be tweeted
// then set 'wrap' to true and overflow text will be broken
// into multiple tweets
wrap: true,
//
// (optional) if you want to add a link to the tweet then specify
// it here. you can also opt to have it wrap to all wrapped
// tweets. if wrap is undefined or false then the link will only
// be displayed for the first tweet
link: {
url: '',
wrap: true // optional, defaults to false
}
};
var tweets = tweetify(tweet);
for (var i = 0; i < tweets.length; i++) {
console.log(tweets[i]);
}
```