hackernews2nntp
Version:
Post Hacker News Stories & Comments to an NNTP Server
33 lines (24 loc) • 746 B
JavaScript
// Generated by CoffeeScript 1.8.0
(function() {
var path;
path = require('path');
exports.isNum = function(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
};
exports.isStr = function(s) {
return toString.apply(s) === '[object String]';
};
exports.randrange = function(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
};
exports.warnx = function(msg) {
return console.error("" + (path.basename(process.argv[1])) + " warning: " + msg);
};
exports.errx = function(msg) {
console.error("" + (path.basename(process.argv[1])) + " error: " + msg);
return process.exit(1);
};
exports.hash_size = function(hash) {
return (Object.keys(hash)).length;
};
}).call(this);