Skip to content

Commit

Permalink
more lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Dec 2, 2010
1 parent ac58d3a commit f22c248
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 76 deletions.
20 changes: 10 additions & 10 deletions lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var writeError = process.binding('stdio').writeError;

// console object
var formatRegExp = /%[sdj]/g;
function format (f) {
function format(f) {
if (typeof f !== 'string') {
var objects = [], util = require('util');
for (var i = 0; i < arguments.length; i++) {
Expand All @@ -14,7 +14,7 @@ function format (f) {

var i = 1;
var args = arguments;
var str = String(f).replace(formatRegExp, function (x) {
var str = String(f).replace(formatRegExp, function(x) {
switch (x) {
case '%s': return args[i++];
case '%d': return +args[i++];
Expand All @@ -30,41 +30,41 @@ function format (f) {
}


exports.log = function () {
exports.log = function() {
process.stdout.write(format.apply(this, arguments) + '\n');
};


exports.info = exports.log;


exports.warn = function () {
exports.warn = function() {
writeError(format.apply(this, arguments) + '\n');
};


exports.error = exports.warn;


exports.dir = function(object){
exports.dir = function(object) {
var util = require('util');
process.stdout.write(util.inspect(object) + '\n');
};


var times = {};
exports.time = function(label){
exports.time = function(label) {
times[label] = Date.now();
};


exports.timeEnd = function(label){
exports.timeEnd = function(label) {
var duration = Date.now() - times[label];
exports.log('%s: %dms', label, duration);
};


exports.trace = function(label){
exports.trace = function(label) {
// TODO probably can to do this better with V8's debug object once that is
// exposed.
var err = new Error;
Expand All @@ -75,8 +75,8 @@ exports.trace = function(label){
};


exports.assert = function(expression){
if(!expression){
exports.assert = function(expression) {
if (!expression) {
var arr = Array.prototype.slice.call(arguments, 1);
process.assert(false, format.apply(this, arr));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = process.binding("constants");
module.exports = process.binding('constants');
20 changes: 10 additions & 10 deletions lib/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ try {
}


function Credentials (method) {
function Credentials(method) {
if (!(this instanceof Credentials)) {
return new Credentials(method);
}
Expand All @@ -38,7 +38,7 @@ function Credentials (method) {
exports.Credentials = Credentials;


exports.createCredentials = function (options) {
exports.createCredentials = function(options) {
if (!options) options = {};
var c = new Credentials(options.method);

Expand All @@ -63,46 +63,46 @@ exports.createCredentials = function (options) {


exports.Hash = Hash;
exports.createHash = function (hash) {
exports.createHash = function(hash) {
return new Hash(hash);
};


exports.Hmac = Hmac;
exports.createHmac = function (hmac, key) {
exports.createHmac = function(hmac, key) {
return (new Hmac).init(hmac, key);
};


exports.Cipher = Cipher;
exports.createCipher = function (cipher, key) {
exports.createCipher = function(cipher, key) {
return (new Cipher).init(cipher, key);
};


exports.createCipheriv = function (cipher, key, iv) {
exports.createCipheriv = function(cipher, key, iv) {
return (new Cipher).initiv(cipher, key, iv);
};


exports.Decipher = Decipher;
exports.createDecipher = function (cipher, key) {
exports.createDecipher = function(cipher, key) {
return (new Decipher).init(cipher, key);
};


exports.createDecipheriv = function (cipher, key, iv) {
exports.createDecipheriv = function(cipher, key, iv) {
return (new Decipher).initiv(cipher, key, iv);
};


exports.Sign = Sign;
exports.createSign = function (algorithm) {
exports.createSign = function(algorithm) {
return (new Sign).init(algorithm);
};

exports.Verify = Verify;
exports.createVerify = function (algorithm) {
exports.createVerify = function(algorithm) {
return (new Verify).init(algorithm);
};

Expand Down
Loading

0 comments on commit f22c248

Please sign in to comment.