Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Fixed a lot of jslint errors.
Browse files Browse the repository at this point in the history
Fixes #1831
  • Loading branch information
Southern authored and ry committed Oct 6, 2011
1 parent 627f379 commit 87286cc
Show file tree
Hide file tree
Showing 175 changed files with 1,237 additions and 1,191 deletions.
34 changes: 17 additions & 17 deletions lib/_debugger.js
Expand Up @@ -256,7 +256,7 @@ Client.prototype.req = function(req, cb) {


Client.prototype.reqVersion = function(cb) {
cb = cb || function () {};
cb = cb || function() {};
this.req({ command: 'version' } , function(err, body, res) {
if (err) return cb(err);
cb(null, res.body.body.V8Version, res.body.running);
Expand All @@ -276,7 +276,7 @@ Client.prototype.reqLookup = function(refs, cb) {
}
};

cb = cb || function () {};
cb = cb || function() {};
this.req(req, function(err, res) {
if (err) return cb(err);
for (var ref in res) {
Expand All @@ -285,7 +285,7 @@ Client.prototype.reqLookup = function(refs, cb) {
}
}

cb(null, res);
cb(null, res);
});
};

Expand All @@ -296,7 +296,7 @@ Client.prototype.reqScopes = function(cb) {
arguments: {}
};

cb = cb || function () {};
cb = cb || function() {};
this.req(req, function(err, res) {
if (err) return cb(err);
var refs = res.scopes.map(function(scope) {
Expand Down Expand Up @@ -328,7 +328,7 @@ Client.prototype.reqEval = function(expression, cb) {
return;
}

cb = cb || function () {};
cb = cb || function() {};
// Otherwise we need to get the current frame to see which scopes it has.
this.reqBacktrace(function(err, bt) {
if (err || !bt.frames) {
Expand Down Expand Up @@ -361,7 +361,7 @@ Client.prototype._reqFramesEval = function(expression, evalFrames, cb) {
var self = this;
var i = evalFrames.shift();

cb = cb || function () {};
cb = cb || function() {};
this.reqFrameEval(expression, i, function(err, res) {
if (!err) return cb(null, res);
self._reqFramesEval(expression, evalFrames, cb);
Expand All @@ -382,7 +382,7 @@ Client.prototype.reqFrameEval = function(expression, frame, cb) {
req.arguments.frame = frame;
}

cb = cb || function () {};
cb = cb || function() {};
this.req(req, function(err, res) {
if (!err) self._addHandle(res);
cb(err, res);
Expand Down Expand Up @@ -415,7 +415,7 @@ Client.prototype.reqBacktrace = function(cb) {
//
Client.prototype.reqScripts = function(cb) {
var self = this;
cb = cb || function () {};
cb = cb || function() {};

this.req({ command: 'scripts' } , function(err, res) {
if (err) return cb(err);
Expand Down Expand Up @@ -502,7 +502,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
return p.ref;
});

cb = cb || function () {};
cb = cb || function() {};
this.reqLookup(propertyRefs, function(err, res) {
if (err) {
console.error('problem with reqLookup');
Expand Down Expand Up @@ -581,7 +581,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
Client.prototype.fullTrace = function(cb) {
var self = this;

cb = cb || function () {};
cb = cb || function() {};
this.reqBacktrace(function(err, trace) {
if (err) return cb(err);
if (trace.totalFrames <= 0) return cb(Error('No frames'));
Expand Down Expand Up @@ -641,7 +641,7 @@ var commands = [
'out (o)',
'backtrace (bt)',
'setBreakpoint (sb)',
'clearBreakpoint (cb)',
'clearBreakpoint (cb)'
],
[
'watch',
Expand Down Expand Up @@ -799,7 +799,7 @@ function Interface(stdin, stdout, args) {
self.resume();
});
}, 10);
};
}


// Stream control
Expand Down Expand Up @@ -882,7 +882,7 @@ Interface.prototype.handleBreak = function(r) {
this.print(SourceInfo(r));

// Show watchers' values
this.watchers(true, function (err) {
this.watchers(true, function(err) {
if (err) return self.error(err);

// And list source
Expand Down Expand Up @@ -1167,9 +1167,9 @@ Interface.prototype.scripts = function() {
script.name == client.currentScript ||
!script.isNative) {
scripts.push(
(script.name == client.currentScript ? '* ' : ' ') +
id + ': ' +
path.basename(script.name)
(script.name == client.currentScript ? '* ' : ' ') +
id + ': ' +
path.basename(script.name)
);
}
}
Expand Down Expand Up @@ -1572,7 +1572,7 @@ Interface.prototype.trySpawn = function(cb) {
});

client.on('close', function() {
self.pause()
self.pause();
self.print('program terminated');
self.resume();
self.client = null;
Expand Down
4 changes: 2 additions & 2 deletions lib/assert.js
Expand Up @@ -74,7 +74,7 @@ function truncate(s, n) {

assert.AssertionError.prototype.toString = function() {
if (this.message) {
return [ this.name + ':', this.message ].join(' ');
return [this.name + ':', this.message].join(' ');
} else {
return [
this.name + ':',
Expand Down Expand Up @@ -122,7 +122,7 @@ assert.fail = fail;

function ok(value, message) {
if (!!!value) fail(value, true, message, '==', assert.ok);
};
}
assert.ok = ok;

// 5. The equality assertion tests shallow, coercive equality with
Expand Down
14 changes: 7 additions & 7 deletions lib/buffer_ieee754.js
@@ -1,20 +1,20 @@
// Copyright (c) 2008, Fair Oaks Labs, Inc.
// All rights reserved.
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
//
// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down Expand Up @@ -69,7 +69,7 @@ exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) {
eMax = (1 << eLen) - 1,
eBias = eMax >> 1,
rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
i = isBE ? (nBytes-1) : 0,
i = isBE ? (nBytes - 1) : 0,
d = isBE ? -1 : 1,
s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;

Expand All @@ -84,7 +84,7 @@ exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) {
e--;
c *= 2;
}
if (e+eBias >= 1) {
if (e + eBias >= 1) {
value += rt / c;
} else {
value += rt * Math.pow(2, 1 - eBias);
Expand Down
10 changes: 5 additions & 5 deletions lib/child_process_uv.js
Expand Up @@ -272,7 +272,7 @@ function setStreamOption(name, index, options) {
if (options.customFds[index] === index) {
options[name] = null;
} else {
throw new Error("customFds not yet supported");
throw new Error('customFds not yet supported');
}
} else {
options[name] = createPipe();
Expand All @@ -283,9 +283,9 @@ function setStreamOption(name, index, options) {
ChildProcess.prototype.spawn = function(options) {
var self = this;

setStreamOption("stdinStream", 0, options);
setStreamOption("stdoutStream", 1, options);
setStreamOption("stderrStream", 2, options);
setStreamOption('stdinStream', 0, options);
setStreamOption('stdoutStream', 1, options);
setStreamOption('stderrStream', 2, options);

var r = this._internal.spawn(options);

Expand All @@ -304,7 +304,7 @@ ChildProcess.prototype.spawn = function(options) {

this._internal.close();
this._internal = null;
throw errnoException("spawn", errno)
throw errnoException('spawn', errno);
}

this.pid = this._internal.pid;
Expand Down
4 changes: 2 additions & 2 deletions lib/crypto.js
Expand Up @@ -96,7 +96,7 @@ exports.createCredentials = function(options, context) {

if (options.crl) {
if (Array.isArray(options.crl)) {
for(var i = 0, len = options.crl.length; i < len; i++) {
for (var i = 0, len = options.crl.length; i < len; i++) {
c.context.addCRL(options.crl[i]);
}
} else {
Expand Down Expand Up @@ -162,7 +162,7 @@ exports.createDiffieHellman = function(size_or_key, enc) {
return new DiffieHellman(size_or_key, enc);
}

}
};

exports.pbkdf2 = PBKDF2;

Expand Down
8 changes: 4 additions & 4 deletions lib/dns_legacy.js
Expand Up @@ -93,15 +93,15 @@ var channel = new dns.Channel({SOCK_STATE_CB: function(socket, read, write) {

// c-ares invokes a callback either synchronously or asynchronously,
// but the dns API should always invoke a callback asynchronously.
//
//
// This function makes sure that the callback is invoked asynchronously.
// It returns a function that invokes the callback within nextTick().
//
//
// To avoid invoking unnecessary nextTick(), `immediately` property of
// returned function should be set to true after c-ares returned.
//
//
// Usage:
//
//
// function someAPI(callback) {
// callback = makeAsync(callback);
// channel.someAPI(..., callback);
Expand Down
24 changes: 12 additions & 12 deletions lib/dns_uv.js
Expand Up @@ -54,15 +54,15 @@ function symToFamily(family) {

// c-ares invokes a callback either synchronously or asynchronously,
// but the dns API should always invoke a callback asynchronously.
//
//
// This function makes sure that the callback is invoked asynchronously.
// It returns a function that invokes the callback within nextTick().
//
//
// To avoid invoking unnecessary nextTick(), `immediately` property of
// returned function should be set to true after c-ares returned.
//
// Usage:
//
//
// Usage:
//
// function someAPI(callback) {
// callback = makeAsync(callback);
// channel.someAPI(..., callback);
Expand Down Expand Up @@ -193,14 +193,14 @@ function resolver(bindingName) {


var resolveMap = {};
exports.resolve4 = resolveMap.A = resolver('queryA');
exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
exports.resolve4 = resolveMap.A = resolver('queryA');
exports.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
exports.resolveCname = resolveMap.CNAME = resolver('queryCname');
exports.resolveMx = resolveMap.MX = resolver('queryMx');
exports.resolveNs = resolveMap.NS = resolver('queryNs');
exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
exports.reverse = resolveMap.PTR = resolver('getHostByAddr');
exports.resolveMx = resolveMap.MX = resolver('queryMx');
exports.resolveNs = resolveMap.NS = resolver('queryNs');
exports.resolveTxt = resolveMap.TXT = resolver('queryTxt');
exports.resolveSrv = resolveMap.SRV = resolver('querySrv');
exports.reverse = resolveMap.PTR = resolver('getHostByAddr');


exports.resolve = function(domain, type_, callback_) {
Expand Down
17 changes: 9 additions & 8 deletions lib/fs.js
Expand Up @@ -194,7 +194,7 @@ fs.closeSync = function(fd) {
};

function modeNum(m, def) {
switch(typeof m) {
switch (typeof m) {
case 'number': return m;
case 'string': return parseInt(m, 8);
default:
Expand Down Expand Up @@ -447,7 +447,7 @@ fs.fchmodSync = function(fd, mode) {
if (constants.hasOwnProperty('O_SYMLINK')) {
fs.lchmod = function(path, mode, callback) {
callback = callback || noop;
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function (err, fd) {
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
if (err) {
callback(err);
return;
Expand All @@ -474,7 +474,7 @@ fs.chmodSync = function(path, mode) {
if (constants.hasOwnProperty('O_SYMLINK')) {
fs.lchown = function(path, uid, gid, callback) {
callback = callback || noop;
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function (err, fd) {
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
if (err) {
callback(err);
return;
Expand Down Expand Up @@ -514,7 +514,7 @@ function toUnixTimestamp(time) {
// convert to 123.456 UNIX timestamp
return time.getTime() / 1000;
}
throw new Error("Cannot parse time: " + time);
throw new Error('Cannot parse time: ' + time);
}

// exported for unit tests, not for public consumption
Expand Down Expand Up @@ -569,7 +569,8 @@ fs.writeFile = function(path, data, encoding_, callback) {
if (openErr) {
if (callback) callback(openErr);
} else {
var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data, encoding);
var buffer = Buffer.isBuffer(data) ? data : new Buffer('' + data,
encoding);
writeAll(fd, buffer, 0, buffer.length, callback);
}
});
Expand Down Expand Up @@ -621,7 +622,7 @@ FSWatcher.prototype.start = function(filename, persistent) {

if (r) {
this._handle.close();
throw errnoException(errno, "watch")
throw errnoException(errno, 'watch');
}
};

Expand Down Expand Up @@ -663,11 +664,11 @@ function StatWatcher() {
this._handle = new binding.StatWatcher();

this._handle.onchange = function(current, previous) {
self.emit('change', current, previous);
self.emit('change', current, previous);
};

this._handle.onstop = function() {
self.emit('stop');
self.emit('stop');
};
}
util.inherits(StatWatcher, EventEmitter);
Expand Down
3 changes: 1 addition & 2 deletions lib/net_legacy.js
Expand Up @@ -459,7 +459,7 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {

this.bytesWritten += bytesWritten;

debug('wrote ' + bytesWritten + ' bytes to socket.')
debug('wrote ' + bytesWritten + ' bytes to socket.');
debug('[fd, off, len] = ' + JSON.stringify([this.fd, off, len]));

timers.active(this);
Expand Down Expand Up @@ -509,7 +509,6 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {

Socket.prototype._onBufferChange = function() {
// Put DTrace hooks here.
;
};


Expand Down

0 comments on commit 87286cc

Please sign in to comment.