0.0.2 • Published 5 years ago

rft v0.0.2

Weekly downloads
9
License
-
Repository
-
Last release
5 years ago

rft - require-from-twitter

Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.

How to use

Source tweets: tweet, tweet

const leftPad = await requireFromTwitter('712799807073419264');
console.log(leftPad(1, 5));      // '00001'
console.log(leftPad(1234, 5));   // '01234'
console.log(leftPad(12345, 5));  // '12345'

Environment variables

This module using these env variables:

const twit = new Twit({
  "consumer_key": process.env.TWITTER_CONSUMER_KEY,
  "consumer_secret": process.env.TWITTER_CONSUMER_SECRET,
  "access_token": process.env.TWITTER_ACCESS_TOKEN,
  "access_token_secret": process.env.TWITTER_ACCESS_TOKEN_SECRET
});

Make sure to set them before runing:

export TWITTER_CONSUMER_KEY="s2yBRrL0Y3GZHKBedkXDpSJ7fUG4PNE4"
export TWITTER_CONSUMER_SECRET="Svp2TuM3FeA2vaN6doSiwz0XFQWsNjGW"
export TWITTER_ACCESS_TOKEN="bOX8twkHiH-vu8aA5Cj5fobLyM9HU1QLK6sSJIHi6uH"
export TWITTER_ACCESS_TOKEN_SECRET="MhZsj8Fmyyal85b8TlsMNtSJ4XHRpfF5"

Running this example

# populate `twitter-config.json` with your API tokens
$ npm install
$ npm test