Permalink
Browse files

Updated builtins

  • Loading branch information...
1 parent 6b8fc06 commit d6800eba3b75bac9f097aff7e5291e2031f9e923 @chriso chriso committed May 31, 2011
Showing with 20 additions and 20 deletions.
  1. +2 −2 builtin/digest.js
  2. +1 −1 builtin/eval.js
  3. +3 −3 builtin/pagerank.js
  4. +1 −1 builtin/query.js
  5. +5 −5 builtin/resolve.js
  6. +1 −1 builtin/statuscode.js
  7. +1 −1 builtin/validate.js
  8. +1 −1 builtin/word_count.coffee
  9. +5 −5 builtin/word_count.js
View
4 builtin/digest.js
@@ -12,10 +12,10 @@
nodeio = require('node.io');
crypto = require('crypto');
Digest = (function() {
+ __extends(Digest, nodeio.JobClass);
function Digest() {
Digest.__super__.constructor.apply(this, arguments);
}
- __extends(Digest, nodeio.JobClass);
Digest.prototype.init = function() {
if (this.options.args.length === 0 || this.options.args[0] === 'help') {
this.status(usage);
@@ -36,7 +36,7 @@
})();
this["class"] = Digest;
this.job = new Digest();
-
+
function crc32 (str) {
var crc32tab = [
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
View
2 builtin/eval.js
@@ -11,10 +11,10 @@
usage = 'This module evaluates an expression on each line of input and emits the result (unless the result is null)\n\n 1. To convert a TSV (tab separated file) to CSV\n $ cat data.tsv | node.io -s eval "input.split(\'\t\').join(\',\')" > data.csv\n\n 2. To remove empty lines from text.txt\n $ cat text.txt | node.io -s eval "input.length ? input : null" > modified.txt';
nodeio = require('node.io');
EvalExp = (function() {
+ __extends(EvalExp, nodeio.JobClass);
function EvalExp() {
EvalExp.__super__.constructor.apply(this, arguments);
}
- __extends(EvalExp, nodeio.JobClass);
EvalExp.prototype.init = function() {
if (this.options.args.length === 0) {
this.exit('Please enter an expression, e.g. `node.io eval "input.length"`');
View
6 builtin/pagerank.js
@@ -15,10 +15,10 @@
retries: 3
};
Pagerank = (function() {
+ __extends(Pagerank, nodeio.JobClass);
function Pagerank() {
Pagerank.__super__.constructor.apply(this, arguments);
}
- __extends(Pagerank, nodeio.JobClass);
Pagerank.prototype.run = function(input) {
var ch, url;
url = input;
@@ -41,10 +41,10 @@
return Pagerank;
})();
UsageDetails = (function() {
+ __extends(UsageDetails, nodeio.JobClass);
function UsageDetails() {
UsageDetails.__super__.constructor.apply(this, arguments);
}
- __extends(UsageDetails, nodeio.JobClass);
UsageDetails.prototype.input = function() {
this.status(usage);
return this.exit();
@@ -56,7 +56,7 @@
pagerank: new Pagerank(options),
help: new UsageDetails()
};
-
+
// BEGIN CODE FOR GENERATING GOOGLE PAGERANK CHECKSUMS
//----------------------------------------------------------------------------------------------
function zF(a,b) {
View
2 builtin/query.js
@@ -11,10 +11,10 @@
usage = 'The query module can be used to select data from a URL.\nUsage: `$ node.io query url [selector] [attribute]`\n\n 1. To pull front page stories from reddit:\n $ node.io query "http://www.reddit.com" a.title\n\n 2. To pull the href attribute from these links:\n $ node.io query "http://www.reddit.com" a.title href';
nodeio = require('node.io');
Query = (function() {
+ __extends(Query, nodeio.JobClass);
function Query() {
Query.__super__.constructor.apply(this, arguments);
}
- __extends(Query, nodeio.JobClass);
Query.prototype.init = function() {
if (this.options.args.length === 0 || this.options.args[0] === 'help') {
this.status(usage);
View
10 builtin/resolve.js
@@ -22,10 +22,10 @@
retries: 1
};
ResolveAll = (function() {
+ __extends(ResolveAll, nodeio.JobClass);
function ResolveAll() {
ResolveAll.__super__.constructor.apply(this, arguments);
}
- __extends(ResolveAll, nodeio.JobClass);
ResolveAll.prototype.run = function(domain) {
return dns.lookup(domain, 4, __bind(function(err, ip) {
if (err != null) {
@@ -41,10 +41,10 @@
return ResolveAll;
})();
HasRecord = (function() {
+ __extends(HasRecord, nodeio.JobClass);
function HasRecord() {
HasRecord.__super__.constructor.apply(this, arguments);
}
- __extends(HasRecord, nodeio.JobClass);
HasRecord.prototype.run = function(domain) {
return dns.lookup(domain, 4, __bind(function(err, ip) {
if (err != null) {
@@ -60,10 +60,10 @@
return HasRecord;
})();
Available = (function() {
+ __extends(Available, nodeio.JobClass);
function Available() {
Available.__super__.constructor.apply(this, arguments);
}
- __extends(Available, nodeio.JobClass);
Available.prototype.run = function(domain) {
return dns.lookup(domain, 4, __bind(function(err, ip) {
if (err != null) {
@@ -80,10 +80,10 @@
})();
unique_ips = [];
UniqueIPs = (function() {
+ __extends(UniqueIPs, nodeio.JobClass);
function UniqueIPs() {
UniqueIPs.__super__.constructor.apply(this, arguments);
}
- __extends(UniqueIPs, nodeio.JobClass);
UniqueIPs.prototype.run = function(domain) {
return dns.lookup(domain, 4, __bind(function(err, ip) {
if (err != null) {
@@ -104,10 +104,10 @@
return UniqueIPs;
})();
UsageDetails = (function() {
+ __extends(UsageDetails, nodeio.JobClass);
function UsageDetails() {
UsageDetails.__super__.constructor.apply(this, arguments);
}
- __extends(UsageDetails, nodeio.JobClass);
UsageDetails.prototype.input = function() {
this.status(usage);
return this.exit();
View
2 builtin/statuscode.js
@@ -11,10 +11,10 @@
usage = 'Make a HEAD request to each URL of input and return the status code\n\n 1. To return the status code (url,status)\n $ cat urls.txt | node.io -s statuscode\n\n 2. To find domains that 404\n $ cat urls.txt | node.io -s statuscode 404\n\n 3. To find domains that redirect\n $ cat urls.txt | node.io -s statuscode 3';
nodeio = require('node.io');
StatusCode = (function() {
+ __extends(StatusCode, nodeio.JobClass);
function StatusCode() {
StatusCode.__super__.constructor.apply(this, arguments);
}
- __extends(StatusCode, nodeio.JobClass);
StatusCode.prototype.init = function() {
if (this.options.args.length && this.options.args[0] === 'help') {
this.status(usage);
View
2 builtin/validate.js
@@ -11,10 +11,10 @@
usage = 'This module is a simple wrapper for node-validator\nAvailable filters are: int, url, ip, alpha, alphanumeric, email\n\n 1. To filter out lines that do not match a filter:\n $ node.io validate [FILTER] < list.txt\n\n 2. To filter out lines that match a filter:\n $ node.io validate not [FILTER] < list.txt';
nodeio = require('node.io');
Validate = (function() {
+ __extends(Validate, nodeio.JobClass);
function Validate() {
Validate.__super__.constructor.apply(this, arguments);
}
- __extends(Validate, nodeio.JobClass);
Validate.prototype.init = function() {
if (this.options.args.length === 0 || this.options.args[0] === 'help') {
this.status(usage);
View
2 builtin/word_count.coffee
@@ -33,7 +33,7 @@ class WordCount extends nodeio.JobClass
complete: ->
output = []
- for word, count in word_count
+ for word, count of word_count
output.push count + ' ' + word
@output output
return true
View
10 builtin/word_count.js
@@ -16,10 +16,10 @@
};
word_count = {};
WordCount = (function() {
+ __extends(WordCount, nodeio.JobClass);
function WordCount() {
WordCount.__super__.constructor.apply(this, arguments);
}
- __extends(WordCount, nodeio.JobClass);
WordCount.prototype.run = function(lines) {
var line, word, words, _i, _j, _len, _len2;
words = [];
@@ -46,10 +46,10 @@
return null;
};
WordCount.prototype.complete = function() {
- var count, output, word, _len;
+ var count, output, word;
output = [];
- for (count = 0, _len = word_count.length; count < _len; count++) {
- word = word_count[count];
+ for (word in word_count) {
+ count = word_count[word];
output.push(count + ' ' + word);
}
this.output(output);
@@ -58,10 +58,10 @@
return WordCount;
})();
UsageDetails = (function() {
+ __extends(UsageDetails, nodeio.JobClass);
function UsageDetails() {
UsageDetails.__super__.constructor.apply(this, arguments);
}
- __extends(UsageDetails, nodeio.JobClass);
UsageDetails.prototype.input = function() {
this.status(usage);
return this.exit();

0 comments on commit d6800eb

Please sign in to comment.