0.0.4 • Published 6 years ago

jsed v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

jsed: JavaScript Stream Editor

latest version published to npm

npm install -g jsed

Usage

Suppose you're dealing with a stream of tweets.

tweetlang.jsed somewhere on your PATH:

#!/usr/bin/env jsed -f
function flatten(s) { return s.replace(/\s+/g, " "); }

module.exports = function(tweet) {
  if (!tweet.delete) {
    return {
      user: tweet.user.screen_name,
      user_lang: tweet.user.lang,
      tweet: flatten(tweet.text),
      tweet_lang: tweet.lang,
    };
  }
};

Then call:

twilight stream | tweetlang.jsed | jq .

twilight stream emits a stream from the Twitter Streaming API spritzer. jq pretty prints JSON.

Or if you don't want to have to chmod +x tweetlang.jsed, call:

twilight stream | jsed ~/Desktop/tweetlang.jsed | jq .

License

Copyright 2014 Christopher Brown. MIT Licensed.

0.0.4

6 years ago

0.0.3

8 years ago

0.0.2

9 years ago

0.0.1

9 years ago