Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a lot of jslint errors.

Fixes #1831
  • Loading branch information...
commit 87286cc7371886d9856edf424785aaa890ba05a9 1 parent 627f379
@Southern Southern authored ry committed
Showing with 1,237 additions and 1,191 deletions.
  1. +17 −17 lib/_debugger.js
  2. +2 −2 lib/assert.js
  3. +7 −7 lib/buffer_ieee754.js
  4. +5 −5 lib/child_process_uv.js
  5. +2 −2 lib/crypto.js
  6. +4 −4 lib/dns_legacy.js
  7. +12 −12 lib/dns_uv.js
  8. +9 −8 lib/fs.js
  9. +1 −2  lib/net_legacy.js
  10. +14 −13 lib/net_uv.js
  11. +6 −6 lib/path.js
  12. +2 −1  lib/readline.js
  13. +15 −14 lib/repl.js
  14. +2 −2 lib/tty_uv.js
  15. +29 −29 lib/util.js
  16. +7 −7 src/node.js
  17. +1 −1  test/common.js
  18. +1 −3 test/disabled/GH-670.js
  19. +16 −15 test/disabled/test-child-process-uid-gid.js
  20. +1 −1  test/disabled/test-dgram-multicast.js
  21. +3 −3 test/disabled/test-http-agent2.js
  22. +7 −7 test/disabled/test-http-big-proxy-responses.js
  23. +19 −19 test/disabled/test-http-default-port.js
  24. +2 −2 test/disabled/test-http-head-request.js
  25. +20 −20 test/disabled/test-https-loop-to-google.js
  26. +1 −1  test/disabled/test-tls-large-push.js
  27. +4 −4 test/disabled/test-tls-server.js
  28. +3 −3 test/disabled/tls-client.js
  29. +1 −1  test/fixtures/GH-892-request.js
  30. +2 −2 test/fixtures/breakpoints.js
  31. +1 −1  test/fixtures/child-process-channel.js
  32. +1 −1  test/fixtures/node_modules/asdf.js
  33. +1 −1  test/fixtures/node_modules/bar.js
  34. +1 −1  test/fixtures/node_modules/baz/index.js
  35. +1 −1  test/fixtures/node_modules/baz/node_modules/asdf.js
  36. +1 −1  test/fixtures/node_modules/foo.js
  37. +1 −1  test/fixtures/node_modules/node_modules/bar.js
  38. +1 −1  test/fixtures/packages/main-index/package-main-module/index.js
  39. +1 −1  test/fixtures/packages/main/package-main-module.js
  40. +2 −1  test/fixtures/test-init-index/index.js
  41. +2 −1  test/fixtures/test-init-native/fs.js
  42. +4 −4 test/internet/test-dns.js
  43. +1 −1  test/message/throw_custom_error.js
  44. +1 −1  test/message/throw_non_error.js
  45. +2 −2 test/pummel/test-http-upload-timeout.js
  46. +8 −8 test/pummel/test-https-large-response.js
  47. +3 −3 test/pummel/test-net-write-callbacks.js
  48. +9 −8 test/pummel/test-next-tick-loops-quick.js
  49. +3 −3 test/pummel/test-tls-throttle.js
  50. +3 −3 test/pummel/test-vm-memleak.js
  51. +11 −11 test/simple/test-assert.js
  52. +48 −47 test/simple/test-buffer.js
  53. +2 −2 test/simple/test-child-process-channel.js
  54. +1 −1  test/simple/test-child-process-customfd-bounded.js
  55. +1 −1  test/simple/test-child-process-cwd.js
  56. +9 −9 test/simple/test-child-process-double-pipe.js
  57. +1 −1  test/simple/test-child-process-env.js
  58. +2 −2 test/simple/test-child-process-exec-cwd.js
  59. +1 −1  test/simple/test-child-process-exec-env.js
  60. +4 −4 test/simple/test-child-process-set-blocking.js
  61. +1 −1  test/simple/test-cli-eval.js
  62. +2 −2 test/simple/test-console-not-call-toString.js
  63. +2 −2 test/simple/test-console.js
  64. +3 −3 test/simple/test-crypto-random.js
  65. +45 −43 test/simple/test-crypto.js
  66. +32 −32 test/simple/test-debugger-client.js
  67. +3 −3 test/simple/test-debugger-repl.js
  68. +2 −1  test/simple/test-error-reporting.js
  69. +3 −2 test/simple/test-eval.js
  70. +1 −1  test/simple/test-event-emitter-once.js
  71. +3 −3 test/simple/test-file-write-stream2.js
  72. +7 −7 test/simple/test-file-write-stream3.js
  73. +2 −1  test/simple/test-fs-open.js
  74. +28 −28 test/simple/test-fs-watch-file.js
  75. +55 −55 test/simple/test-fs-watch.js
  76. +32 −32 test/simple/test-http-1.0.js
  77. +15 −15 test/simple/test-http-abort-client.js
  78. +3 −3 test/simple/test-http-agent.js
  79. +2 −2 test/simple/test-http-allow-req-after-204-res.js
  80. +3 −3 test/simple/test-http-buffer-sanity.js
  81. +13 −9 test/simple/test-http-chunked.js
  82. +13 −13 test/simple/test-http-client-abort.js
  83. +3 −3 test/simple/test-http-client-parse-error.js
  84. +2 −2 test/simple/test-http-client-upload-buf.js
  85. +2 −2 test/simple/test-http-client-upload.js
  86. +2 −1  test/simple/test-http-conn-reset.js
  87. +2 −2 test/simple/test-http-curl-chunk-problem.js
  88. +1 −1  test/simple/test-http-default-encoding.js
  89. +9 −8 test/simple/test-http-dns-error.js
  90. +12 −12 test/simple/test-http-dns-fail.js
  91. +3 −3 test/simple/test-http-expect-continue.js
  92. +13 −13 test/simple/test-http-extra-response.js
  93. +6 −6 test/simple/test-http-get-pipeline-problem.js
  94. +2 −2 test/simple/test-http-head-request.js
  95. +2 −2 test/simple/test-http-head-response-has-no-body-end.js
  96. +3 −3 test/simple/test-http-header-read.js
  97. +1 −1  test/simple/test-http-host-headers.js
  98. +38 −20 test/simple/test-http-keep-alive-close-on-header.js
  99. +8 −8 test/simple/test-http-keep-alive.js
  100. +1 −1  test/simple/test-http-many-keep-alive-connections.js
  101. +10 −10 test/simple/test-http-multi-line-headers.js
  102. +7 −7 test/simple/test-http-mutable-headers.js
  103. +1 −1  test/simple/test-http-request-end-twice.js
  104. +1 −1  test/simple/test-http-request-end.js
  105. +4 −4 test/simple/test-http-response-close.js
  106. +3 −3 test/simple/test-http-set-timeout.js
  107. +2 −2 test/simple/test-http-status-code.js
  108. +7 −6 test/simple/test-http-unix-socket.js
  109. +6 −6 test/simple/test-http-upgrade-agent.js
  110. +3 −3 test/simple/test-http-upgrade-client2.js
  111. +2 −2 test/simple/test-http.js
  112. +4 −4 test/simple/test-https-agent.js
  113. +1 −1  test/simple/test-https-connecting-to-http.js
  114. +1 −1  test/simple/test-https-eof-for-eom.js
  115. +18 −17 test/simple/test-https-foafssl.js
  116. +10 −10 test/simple/test-https-simple.js
  117. +18 −18 test/simple/test-init.js
  118. +7 −7 test/simple/test-module-load-list.js
  119. +5 −3 test/simple/test-module-loading.js
  120. +4 −4 test/simple/test-net-bytes-stats.js
  121. +4 −4 test/simple/test-net-connect-buffer.js
  122. +4 −4 test/simple/test-net-connect-timeout.js
  123. +1 −1  test/simple/test-net-create-connection.js
  124. +2 −2 test/simple/test-net-pingpong.js
  125. +7 −7 test/simple/test-net-server-try-ports.js
  126. +2 −2 test/simple/test-net-stream.js
  127. +8 −8 test/simple/test-os.js
  128. +30 −30 test/simple/test-path.js
  129. +1 −1  test/simple/test-pipe-file-to-http.js
  130. +4 −3 test/simple/test-pipe-stream.js
  131. +3 −3 test/simple/test-pipe.js
  132. +1 −1  test/simple/test-process-env.js
  133. +2 −2 test/simple/test-process-kill-null.js
  134. +5 −5 test/simple/test-process-wrap.js
  135. +2 −2 test/simple/test-querystring.js
  136. +2 −2 test/simple/test-readdouble.js
  137. +2 −2 test/simple/test-readfloat.js
  138. +7 −7 test/simple/test-regress-GH-1531.js
  139. +4 −4 test/simple/test-regress-GH-1726.js
  140. +6 −6 test/simple/test-regress-GH-784.js
  141. +1 −1  test/simple/test-regress-GH-819.js
  142. +7 −7 test/simple/test-regress-GH-877.js
  143. +4 −4 test/simple/test-regress-GH-892.js
  144. +1 −1  test/simple/test-regress-GH-897.js
  145. +4 −4 test/simple/test-repl.js
  146. +2 −2 test/simple/test-require-cache-without-stat.js
  147. +3 −3 test/simple/test-script-context.js
  148. +2 −2 test/simple/test-signal-handler.js
  149. +2 −1  test/simple/test-stdin-from-file.js
  150. +19 −19 test/simple/test-stream-pipe-cleanup.js
  151. +4 −4 test/simple/test-stream-pipe-event.js
  152. +19 −19 test/simple/test-stream-pipe-multi.js
  153. +4 −4 test/simple/test-tcp-wrap-connect.js
  154. +9 −9 test/simple/test-tcp-wrap-listen.js
  155. +3 −3 test/simple/test-tcp-wrap.js
  156. +6 −6 test/simple/test-timers-linked-list.js
  157. +2 −2 test/simple/test-tls-client-abort.js
  158. +6 −6 test/simple/test-tls-client-resume.js
  159. +43 −43 test/simple/test-tls-client-verify.js
  160. +4 −3 test/simple/test-tls-connect.js
  161. +5 −4 test/simple/test-tls-ext-key-usage.js
  162. +7 −7 test/simple/test-tls-junk-closes-server.js
  163. +4 −4 test/simple/test-tls-npn-server-client.js
  164. +1 −1  test/simple/test-tls-peer-certificate.js
  165. +3 −3 test/simple/test-tls-securepair-client.js
  166. +3 −2 test/simple/test-tls-securepair-server.js
  167. +48 −47 test/simple/test-tls-server-verify.js
  168. +1 −1  test/simple/test-tls-set-encoding.js
  169. +4 −4 test/simple/test-tls-sni-server-client.js
  170. +3 −3 test/simple/test-tty-wrap.js
  171. +6 −6 test/simple/test-util-inspect.js
  172. +2 −1  test/simple/test-vm-create-context-circular-reference.js
  173. +2 −2 test/simple/test-writedouble.js
  174. +4 −4 test/simple/test-writefloat.js
  175. +66 −66 test/simple/test-zlib.js
View
34 lib/_debugger.js
@@ -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);
@@ -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) {
@@ -285,7 +285,7 @@ Client.prototype.reqLookup = function(refs, cb) {
}
}
- cb(null, res);
+ cb(null, res);
});
};
@@ -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) {
@@ -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) {
@@ -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);
@@ -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);
@@ -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);
@@ -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');
@@ -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'));
@@ -641,7 +641,7 @@ var commands = [
'out (o)',
'backtrace (bt)',
'setBreakpoint (sb)',
- 'clearBreakpoint (cb)',
+ 'clearBreakpoint (cb)'
],
[
'watch',
@@ -799,7 +799,7 @@ function Interface(stdin, stdout, args) {
self.resume();
});
}, 10);
-};
+}
// Stream control
@@ -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
@@ -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)
);
}
}
@@ -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;
View
4 lib/assert.js
@@ -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 + ':',
@@ -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
View
14 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
@@ -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;
@@ -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);
View
10 lib/child_process_uv.js
@@ -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();
@@ -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);
@@ -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;
View
4 lib/crypto.js
@@ -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 {
@@ -162,7 +162,7 @@ exports.createDiffieHellman = function(size_or_key, enc) {
return new DiffieHellman(size_or_key, enc);
}
-}
+};
exports.pbkdf2 = PBKDF2;
View
8 lib/dns_legacy.js
@@ -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);
View
24 lib/dns_uv.js
@@ -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);
@@ -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_) {
View
17 lib/fs.js
@@ -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:
@@ -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;
@@ -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;
@@ -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
@@ -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);
}
});
@@ -621,7 +622,7 @@ FSWatcher.prototype.start = function(filename, persistent) {
if (r) {
this._handle.close();
- throw errnoException(errno, "watch")
+ throw errnoException(errno, 'watch');
}
};
@@ -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);
View
3  lib/net_legacy.js
@@ -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);
@@ -509,7 +509,6 @@ Socket.prototype._writeOut = function(data, encoding, fd, cb) {
Socket.prototype._onBufferChange = function() {
// Put DTrace hooks here.
- ;
};
View
27 lib/net_uv.js
@@ -18,8 +18,8 @@ function createTCP() {
/* Bit flags for socket._flags */
-var FLAG_GOT_EOF = 1 << 0;
-var FLAG_SHUTDOWN = 1 << 1;
+var FLAG_GOT_EOF = 1 << 0;
+var FLAG_SHUTDOWN = 1 << 1;
var FLAG_DESTROY_SOON = 1 << 2;
var FLAG_SHUTDOWNQUED = 1 << 3;
@@ -378,7 +378,7 @@ Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) {
if (this._connectQueue) {
this._connectQueue.push([data, encoding, fd, cb]);
} else {
- this._connectQueue = [ [data, encoding, fd, cb] ];
+ this._connectQueue = [[data, encoding, fd, cb]];
}
return false;
}
@@ -418,7 +418,7 @@ function afterWrite(status, handle, req, buffer) {
if (req.cb) req.cb();
- if (self._writeRequests.length == 0 && self._flags & FLAG_DESTROY_SOON) {
+ if (self._writeRequests.length == 0 && self._flags & FLAG_DESTROY_SOON) {
self.destroy();
}
}
@@ -481,7 +481,7 @@ Socket.prototype.connect = function(port /* [host], [cb] */) {
connect(self, /*pipe_name=*/port);
} else if (typeof host == 'string') {
- debug("connect: find host " + host);
+ debug('connect: find host ' + host);
require('dns').lookup(host, function(err, ip, addressType) {
// It's possible we were destroyed while looking this up.
// XXX it would be great if we could cancel the promise returned by
@@ -510,7 +510,7 @@ Socket.prototype.connect = function(port /* [host], [cb] */) {
});
} else {
- debug("connect: missing host");
+ debug('connect: missing host');
connect(self, '127.0.0.1', port, 4);
}
};
@@ -526,7 +526,7 @@ function afterConnect(status, handle, req) {
assert.equal(handle, self._handle);
- debug("afterConnect");
+ debug('afterConnect');
assert.ok(self._connecting);
self._connecting = false;
@@ -553,7 +553,7 @@ function afterConnect(status, handle, req) {
self.end();
}
} else {
- self._connectQueueCleanUp()
+ self._connectQueueCleanUp();
self.destroy(errnoException(errno, 'connect'));
}
}
@@ -585,7 +585,7 @@ function Server(/* [ options, ] listener */) {
self.on('connection', arguments[0]);
} else {
options = arguments[0] || {};
-
+
if (typeof arguments[1] == 'function') {
self.on('connection', arguments[1]);
}
@@ -616,7 +616,7 @@ function listen(self, address, port, addressType) {
self._handle.onconnection = onconnection;
if (address || port) {
- debug("bind to " + address);
+ debug('bind to ' + address);
if (addressType == 6) {
r = self._handle.bind6(address, port);
} else {
@@ -693,7 +693,7 @@ function onconnection(clientHandle) {
var self = handle.socket;
var peername;
- debug("onconnection");
+ debug('onconnection');
if (!clientHandle) {
self.emit('error', errnoException(errno, 'accept'));
@@ -778,12 +778,13 @@ exports.isIP = function(input) {
}
}
return 4;
- } else if (/^::|^::1|^([a-fA-F0-9]{1,4}::?){1,7}([a-fA-F0-9]{1,4})$/.test(input)) {
+ } else if (/^::|^::1|^([a-fA-F0-9]{1,4}::?){1,7}([a-fA-F0-9]{1,4})$/.test(
+ input)) {
return 6;
} else {
return 0;
}
-}
+};
exports.isIPv4 = function(input) {
View
12 lib/path.js
@@ -30,7 +30,7 @@ var isWindows = process.platform === 'win32';
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
- for (var i = parts.length-1; i >= 0; i--) {
+ for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last == '.') {
parts.splice(i, 1);
@@ -63,8 +63,8 @@ if (isWindows) {
// Regex to split the tail part of the above into [*, dir, basename, ext]
var splitTailRe = /^([\s\S]+[\\\/](?!$)|[\\\/])?((?:[\s\S]+?)?(\.[^.]*)?)$/;
- // Function to split a filename into [root, dir, basename, ext]
- // windows version
+ // Function to split a filename into [root, dir, basename, ext]
+ // windows version
var splitPath = function(filename) {
// Separate device+slash from tail
var result = splitDeviceRe.exec(filename),
@@ -76,7 +76,7 @@ if (isWindows) {
basename = result2[2] || '',
ext = result2[3] || '';
return [device, dir, basename, ext];
- }
+ };
// path.resolve([from ...], to)
// windows version
@@ -85,7 +85,7 @@ if (isWindows) {
resolvedTail = '',
resolvedAbsolute = false;
- for (var i = arguments.length-1; i >= -1; i--) {
+ for (var i = arguments.length - 1; i >= -1; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
@@ -272,7 +272,7 @@ if (isWindows) {
var resolvedPath = '',
resolvedAbsolute = false;
- for (var i = arguments.length-1; i >= -1 && !resolvedAbsolute; i--) {
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
View
3  lib/readline.js
@@ -292,7 +292,8 @@ Interface.prototype._tabComplete = function() {
var item = group[idx];
self.output.write(item);
if (col < maxColumns - 1) {
- for (var s = 0, itemLen = item.length; s < width - itemLen; s++) {
+ for (var s = 0, itemLen = item.length; s < width - itemLen;
+ s++) {
self.output.write(' ');
}
}
View
29 lib/repl.js
@@ -110,7 +110,8 @@ function REPLServer(prompt, stream, eval) {
this.commands = {};
defineDefaultCommands(this);
- if (rli.enabled && !exports.disableColors && exports.writer === util.inspect) {
+ if (rli.enabled && !exports.disableColors &&
+ exports.writer === util.inspect) {
// Turn on ANSI coloring.
exports.writer = function(obj, showHidden, depth) {
return util.inspect(obj, showHidden, depth, true);
@@ -175,15 +176,15 @@ function REPLServer(prompt, stream, eval) {
self.context,
'repl',
function(e, ret) {
- if (e && !isSyntaxError(e)) return finish(e);
+ if (e && !isSyntaxError(e)) return finish(e);
- if (typeof ret === 'function' || e) {
- // Now as statement without parens.
- self.eval(evalCmd, self.context, 'repl', finish);
- } else {
- finish(null, ret);
- }
- });
+ if (typeof ret === 'function' || e) {
+ // Now as statement without parens.
+ self.eval(evalCmd, self.context, 'repl', finish);
+ } else {
+ finish(null, ret);
+ }
+ });
} else {
finish(null);
@@ -447,11 +448,11 @@ REPLServer.prototype.complete = function(line, callback) {
// they just get in the way.
if (filter) {
completionGroups.push(['break', 'case', 'catch', 'const',
- 'continue', 'debugger', 'default', 'delete', 'do', 'else', 'export',
- 'false', 'finally', 'for', 'function', 'if', 'import', 'in',
- 'instanceof', 'let', 'new', 'null', 'return', 'switch', 'this',
- 'throw', 'true', 'try', 'typeof', 'undefined', 'var', 'void',
- 'while', 'with', 'yield']);
+ 'continue', 'debugger', 'default', 'delete', 'do', 'else',
+ 'export', 'false', 'finally', 'for', 'function', 'if',
+ 'import', 'in', 'instanceof', 'let', 'new', 'null', 'return',
+ 'switch', 'this', 'throw', 'true', 'try', 'typeof', 'undefined',
+ 'var', 'void', 'while', 'with', 'yield']);
}
}
View
4 lib/tty_uv.js
@@ -34,7 +34,7 @@ exports.isatty = function(fd) {
exports.setRawMode = function(flag) {
- assert.ok(stdinHandle, "stdin must be initialized before calling setRawMode");
+ assert.ok(stdinHandle, 'stdin must be initialized before calling setRawMode');
stdinHandle.setRawMode(flag);
};
@@ -46,7 +46,7 @@ exports.getWindowSize = function() {
exports.setWindowSize = function() {
- throw new Error("implement me");
+ throw new Error('implement me');
};
View
58 lib/util.js
@@ -54,7 +54,7 @@ exports.format = function(f) {
}
}
return str;
-}
+};
exports.print = function() {
@@ -98,7 +98,7 @@ function inspect(obj, showHidden, depth, colors) {
var ctx = {
showHidden: showHidden,
seen: [],
- stylize: colors ? stylizeWithColor : stylizeNoColor,
+ stylize: colors ? stylizeWithColor : stylizeNoColor
};
return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth));
}
@@ -107,31 +107,31 @@ exports.inspect = inspect;
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
var colors = {
- 'bold' : [1, 22],
- 'italic' : [3, 23],
- 'underline' : [4, 24],
- 'inverse' : [7, 27],
- 'white' : [37, 39],
- 'grey' : [90, 39],
- 'black' : [30, 39],
- 'blue' : [34, 39],
- 'cyan' : [36, 39],
- 'green' : [32, 39],
- 'magenta' : [35, 39],
- 'red' : [31, 39],
- 'yellow' : [33, 39]
+ 'bold' : [1, 22],
+ 'italic' : [3, 23],
+ 'underline' : [4, 24],
+ 'inverse' : [7, 27],
+ 'white' : [37, 39],
+ 'grey' : [90, 39],
+ 'black' : [30, 39],
+ 'blue' : [34, 39],
+ 'cyan' : [36, 39],
+ 'green' : [32, 39],
+ 'magenta' : [35, 39],
+ 'red' : [31, 39],
+ 'yellow' : [33, 39]
};
var styles = {
- 'special': 'cyan',
- 'number': 'blue',
- 'boolean': 'yellow',
- 'undefined': 'grey',
- 'null': 'bold',
- 'string': 'green',
- 'date': 'magenta',
- // "name": intentionally not styling
- 'regexp': 'red'
+ 'special': 'cyan',
+ 'number': 'blue',
+ 'boolean': 'yellow',
+ 'undefined': 'grey',
+ 'null': 'bold',
+ 'string': 'green',
+ 'date': 'magenta',
+ // "name": intentionally not styling
+ 'regexp': 'red'
};
@@ -282,7 +282,7 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
for (var i = 0, l = value.length; i < l; ++i) {
if (Object.prototype.hasOwnProperty.call(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- String(i), true));
+ String(i), true));
} else {
output.push('');
}
@@ -290,7 +290,7 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- key, true));
+ key, true));
}
});
return output;
@@ -387,19 +387,19 @@ function isArray(ar) {
function isRegExp(re) {
return re instanceof RegExp ||
- (typeof re === 'object' && objectToString(re) === '[object RegExp]');
+ (typeof re === 'object' && objectToString(re) === '[object RegExp]');
}
function isDate(d) {
return d instanceof Date ||
- (typeof d === 'object' && objectToString(d) === '[object Date]');
+ (typeof d === 'object' && objectToString(d) === '[object Date]');
}
function isError(e) {
return e instanceof Error ||
- (typeof e === 'object' && objectToString(e) === '[object Error]');
+ (typeof e === 'object' && objectToString(e) === '[object Error]');
}
View
14 src/node.js
@@ -227,7 +227,7 @@
case 'TTY':
var tty = NativeModule.require('tty');
stdout = new tty.WriteStream(fd);
- stdout._type = "tty";
+ stdout._type = 'tty';
// Hack to have stdout not keep the event loop alive.
// See https://github.com/joyent/node/issues/1726
@@ -237,7 +237,7 @@
case 'FILE':
var fs = NativeModule.require('fs');
stdout = new fs.WriteStream(null, {fd: fd});
- stdout._type = "fs";
+ stdout._type = 'fs';
break;
case 'PIPE':
@@ -249,7 +249,7 @@
// we'll just add this hack and set the `readable` member to false.
// Test: ./node test/fixtures/echo.js < /etc/passwd
stdout.readable = false;
- stdout._type = "pipe";
+ stdout._type = 'pipe';
// FIXME Hack to have stdout not keep the event loop alive.
// See https://github.com/joyent/node/issues/1726
@@ -258,7 +258,7 @@
default:
// Probably an error on in uv_guess_handle()
- throw new Error("Implement me. Unknown stdout file type!");
+ throw new Error('Implement me. Unknown stdout file type!');
}
// For supporting legacy API we put the FD here.
@@ -301,7 +301,7 @@
default:
// Probably an error on in uv_guess_handle()
- throw new Error("Implement me. Unknown stdin file type!");
+ throw new Error('Implement me. Unknown stdin file type!');
}
// For supporting legacy API we put the FD here.
@@ -403,7 +403,7 @@
'mixin': 'process.mixin() has been removed.',
'createChildProcess': 'childProcess API has changed. See doc/api.txt.',
'inherits': 'process.inherits() has moved to sys.inherits.',
- '_byteLength': 'process._byteLength() has moved to Buffer.byteLength',
+ '_byteLength': 'process._byteLength() has moved to Buffer.byteLength'
};
startup.removedMethods = function() {
@@ -498,7 +498,7 @@
throw new Error('No such native module ' + id);
}
- process.moduleLoadList.push("NativeModule " + id);
+ process.moduleLoadList.push('NativeModule ' + id);
var nativeModule = new NativeModule(id);
View
2  test/common.js
@@ -69,7 +69,7 @@ exports.ddCommand = function(filename, kilobytes) {
exports.spawnPwd = function(options) {
var spawn = require('child_process').spawn;
- if (process.platform == "win32") {
+ if (process.platform == 'win32') {
return spawn('cmd.exe', ['/c', 'cd'], options);
} else {
return spawn('pwd', [], options);
View
4 test/disabled/GH-670.js
@@ -31,9 +31,7 @@ req.on('error', function(e) {
function loadDom() {
// Do a lot of computation to stall the process.
// In the meantime the socket will be disconnected.
- for (var i = 0; i < 1e8; i++) {
- ;
- }
+ for (var i = 0; i < 1e8; i++);
console.log('Dom loaded.');
}
View
31 test/disabled/test-child-process-uid-gid.js
@@ -22,15 +22,16 @@
// libuv-broken
-var assert = require("assert");
-var spawn = require("child_process").spawn;
+var assert = require('assert');
+var spawn = require('child_process').spawn;
var fs = require('fs');
var myUid = process.getuid();
var myGid = process.getgid();
if (myUid != 0) {
- console.error('must be run as root, otherwise the gid/uid setting will fail.');
+ console.error('must be run as root, otherwise the gid/uid setting will' +
+ ' fail.');
process.exit(1);
}
@@ -39,9 +40,9 @@ if (myUid != 0) {
var passwd = fs.readFileSync('/etc/passwd', 'utf8');
passwd = passwd.trim().split(/\n/);
-for (var i = 0, l = passwd.length; i < l; i ++) {
- if (passwd[i].charAt(0) === "#") continue;
- passwd[i] = passwd[i].split(":");
+for (var i = 0, l = passwd.length; i < l; i++) {
+ if (passwd[i].charAt(0) === '#') continue;
+ passwd[i] = passwd[i].split(':');
var otherName = passwd[i][0];
var otherUid = +passwd[i][2];
var otherGid = +passwd[i][3];
@@ -62,20 +63,20 @@ whoNumber.stdout.buf = 'byNumber:';
whoName.stdout.buf = 'byName:';
whoNumber.stdout.on('data', onData);
whoName.stdout.on('data', onData);
-function onData (c) { this.buf += c; }
+function onData(c) { this.buf += c; }
-whoNumber.on("exit", onExit);
-whoName.on("exit", onExit);
+whoNumber.on('exit', onExit);
+whoName.on('exit', onExit);
-function onExit (code) {
+function onExit(code) {
var buf = this.stdout.buf;
console.log(buf);
- var expr = new RegExp("^(byName|byNumber):uid=" +
+ var expr = new RegExp('^(byName|byNumber):uid=' +
otherUid +
- "\\(" +
+ '\\(' +
otherName +
- "\\) gid=" +
+ '\\) gid=' +
otherGid +
- "\\(");
- assert.ok(buf.match(expr), "uid and gid should match " + otherName);
+ '\\(');
+ assert.ok(buf.match(expr), 'uid and gid should match ' + otherName);
}
View
2  test/disabled/test-dgram-multicast.js
@@ -82,7 +82,7 @@ function mkListener() {
if (receivedMessages.length == sendMessages.length) {
listenSocket.dropMembership(LOCAL_BROADCAST_HOST);
process.nextTick(function() { // TODO should be changed to below.
- // listenSocket.dropMembership(LOCAL_BROADCAST_HOST, function() {
+ // listenSocket.dropMembership(LOCAL_BROADCAST_HOST, function() {
listenSocket.close();
});
}
View
6 test/disabled/test-http-agent2.js
@@ -30,7 +30,7 @@ var reqEndCount = 0;
var server = http.Server(function(req, res) {
res.writeHead(200);
- res.end("hello world\n");
+ res.end('hello world\n');
var buffer = '';
@@ -50,7 +50,7 @@ var responses = 0;
var N = 10;
var M = 10;
-var body = ''
+var body = '';
for (var i = 0; i < 1000; i++) {
body += 'hello world';
}
@@ -63,7 +63,7 @@ var options = {
server.listen(common.PORT, function() {
for (var i = 0; i < N; i++) {
- setTimeout(function () {
+ setTimeout(function() {
for (var j = 0; j < M; j++) {
var req = http.request(options, function(res) {
View
14 test/disabled/test-http-big-proxy-responses.js
@@ -58,10 +58,10 @@ var proxy = http.createServer(function(req, res) {
}
var proxy_req = http.request({
- host: 'localhost',
- port: 9000,
- method: req.method,
- path: req.url,
+ host: 'localhost',
+ port: 9000,
+ method: req.method,
+ path: req.url,
headers: req.headers
}, function(proxy_res) {
res.writeHead(proxy_res.statusCode, proxy_res.headers);
@@ -96,9 +96,9 @@ function call_chargen(list) {
var recved = 0;
var req = http.request({
- port: 9001,
- host: 'localhost',
- path: '/',
+ port: 9001,
+ host: 'localhost',
+ path: '/',
headers: {'x-len': len}
}, function(res) {
View
38 test/disabled/test-http-default-port.js
@@ -24,44 +24,44 @@
// This must be run as root.
-var http = require("http"),
- https = require("https"),
+var http = require('http'),
+ https = require('https'),
PORT = 80,
SSLPORT = 443,
- assert = require("assert"),
- hostExpect = "localhost",
- fs = require("fs"),
- path = require("path"),
- fixtures = path.resolve(__dirname, "../fixtures/keys"),
+ assert = require('assert'),
+ hostExpect = 'localhost',
+ fs = require('fs'),
+ path = require('path'),
+ fixtures = path.resolve(__dirname, '../fixtures/keys'),
options = {
key: fs.readFileSync(fixtures + '/agent1-key.pem'),
cert: fs.readFileSync(fixtures + '/agent1-cert.pem')
};
-http.createServer(function (req, res) {
+http.createServer(function(req, res) {
console.error(req.headers);
assert.equal(req.headers.host, hostExpect);
res.writeHead(200);
- res.end("ok");
+ res.end('ok');
this.close();
}).listen(PORT);
-https.createServer(options, function (req, res) {
+https.createServer(options, function(req, res) {
console.error(req.headers);
assert.equal(req.headers.host, hostExpect);
res.writeHead(200);
- res.end("ok");
+ res.end('ok');
this.close();
}).listen(SSLPORT);
http
- .get({ host: "localhost",
- port: PORT,
- headers: { "x-port": PORT } })
- .on("response", function(res) {});
+ .get({ host: 'localhost',
+ port: PORT,
+ headers: { 'x-port': PORT } })
+ .on('response', function(res) {});
https
- .get({ host: "localhost",
- port: SSLPORT,
- headers: { "x-port": SSLPORT } })
- .on("response", function(res) {});
+ .get({ host: 'localhost',
+ port: SSLPORT,
+ headers: { 'x-port': SSLPORT } })
+ .on('response', function(res) {});
View
4 test/disabled/test-http-head-request.js
@@ -46,9 +46,9 @@ var gotEnd = false;
server.addListener('listening', function() {
var request = http.request({
- port: common.PORT,
+ port: common.PORT,
method: 'HEAD',
- path: '/'
+ path: '/'
}, function(response) {
console.log('got response');
response.addListener('data', function() {
View
40 test/disabled/test-https-loop-to-google.js
@@ -30,26 +30,26 @@
var https = require('https');
-for(var i = 0; i < 10; ++i)
+for (var i = 0; i < 10; ++i)
{
https.get(
- {
- host: 'www.google.com',
- path: '/accounts/o8/id',
- port: 443,
- }, function(res)
- {
- var data = '';
- res.on('data', function(chunk)
- {
- data += chunk;
- });
- res.on('end', function()
- {
- console.log(res.statusCode);
- });
- }).on('error', function(error)
- {
- console.log(error);
- });
+ {
+ host: 'www.google.com',
+ path: '/accounts/o8/id',
+ port: 443
+ }, function(res)
+ {
+ var data = '';
+ res.on('data', function(chunk)
+ {
+ data += chunk;
+ });
+ res.on('end', function()
+ {
+ console.log(res.statusCode);
+ });
+ }).on('error', function(error)
+ {
+ console.log(error);
+ });
}
View
2  test/disabled/test-tls-large-push.js
@@ -33,7 +33,7 @@ var fs = require('fs');
var body = '';
process.stdout.write('build body...');
-for (var i = 0; i < 10*1024*1024; i++) {
+for (var i = 0; i < 10 * 1024 * 1024; i++) {
body += 'hello world\n';
}
process.stdout.write('done\n');
View
8 test/disabled/test-tls-server.js
@@ -38,10 +38,10 @@ var key = fs.readFileSync(join(common.fixturesDir, 'agent.key')).toString();
var cert = fs.readFileSync(join(common.fixturesDir, 'agent.crt')).toString();
s = tls.Server({ key: key,
- cert: cert,
- ca: [],
- requestCert: true,
- rejectUnauthorized: true });
+ cert: cert,
+ ca: [],
+ requestCert: true,
+ rejectUnauthorized: true });
s.listen(common.PORT, function() {
console.log('TLS server on 127.0.0.1:%d', common.PORT);
View
6 test/disabled/tls-client.js
@@ -30,13 +30,13 @@ var fs = require('fs');
// most servers don't require certificates
var options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
+ key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem')
};
-var s = tls.connect(443, "joyent.com", options, function() {
+var s = tls.connect(443, 'joyent.com', options, function() {
if (!s.authorized) {
- console.error("CONNECTED: " + s.authorizationError);
+ console.error('CONNECTED: ' + s.authorizationError);
s.destroy();
return;
}
View
2  test/fixtures/GH-892-request.js
@@ -38,7 +38,7 @@ var options = {
var req = https.request(options, function(res) {
assert.equal(200, res.statusCode);
gotResponse = true;
- console.error("DONE");
+ console.error('DONE');
});
req.end(new Buffer(bytesExpected));
View
4 test/fixtures/breakpoints.js
@@ -6,10 +6,10 @@ function a(x) {
while (--i != 0);
debugger;
return i;
-};
+}
function b() {
return ['hello', 'world'].join(' ');
-};
+}
a();
a(1);
b();
View
2  test/fixtures/child-process-channel.js
@@ -1,6 +1,6 @@
var assert = require('assert');
-console.log("NODE_CHANNEL_FD", process.env.NODE_CHANNEL_FD);
+console.log('NODE_CHANNEL_FD', process.env.NODE_CHANNEL_FD);
assert.ok(process.env.NODE_CHANNEL_FD);
var fd = parseInt(process.env.NODE_CHANNEL_FD);
View
2  test/fixtures/node_modules/asdf.js
@@ -20,5 +20,5 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
throw new Error('Should not ever get here.');
View
2  test/fixtures/node_modules/bar.js
@@ -20,4 +20,4 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
View
2  test/fixtures/node_modules/baz/index.js
@@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
// this should work, and get the one that doesn't throw
var assert = require('assert');
assert.equal(require('bar'), require('../bar.js'));
View
2  test/fixtures/node_modules/baz/node_modules/asdf.js
@@ -20,4 +20,4 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
View
2  test/fixtures/node_modules/foo.js
@@ -20,6 +20,6 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
var assert = require('assert');
assert.equal(require('baz'), require('./baz/index.js'));
View
2  test/fixtures/node_modules/node_modules/bar.js
@@ -20,5 +20,5 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
console.error(__filename);
-console.error(module.paths.join('\n')+'\n');
+console.error(module.paths.join('\n') + '\n');
throw new Error('Should not ever get here.');
View
2  test/fixtures/packages/main-index/package-main-module/index.js
@@ -19,4 +19,4 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-exports.ok = "ok"
+exports.ok = 'ok';
View
2  test/fixtures/packages/main/package-main-module.js
@@ -19,4 +19,4 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-exports.ok = "ok"
+exports.ok = 'ok';
View
3  test/fixtures/test-init-index/index.js
@@ -21,4 +21,5 @@
(function() {
require('util').print('Loaded successfully!');
-})();
+})();
+
View
3  test/fixtures/test-init-native/fs.js
@@ -24,4 +24,5 @@
if (fs.readFile) {
require('util').print('fs loaded successfully');
}
-})();
+})();
+
View
8 test/internet/test-dns.js
@@ -19,9 +19,9 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
-var assert = require('assert');
+var assert = require('assert'),
dns = require('dns'),
- net = require('net_uv');
+ net = require('net_uv'),
isIP = net.isIP,
isIPv4 = net.isIPv4,
isIPv6 = net.isIPv6,
@@ -149,7 +149,7 @@ TEST(function test_reverse_bogus(done) {
var req = dns.reverse('bogus ip', function() {
assert.ok(false);
});
- } catch(e) {
+ } catch (e) {
error = e;
}
@@ -315,7 +315,7 @@ TEST(function test_lookup_ipv6_implicit(done) {
TEST(function test_lookup_failure(done) {
var req = dns.lookup('does.not.exist', 4, function(err, ip, family) {
assert.ok(err instanceof Error);
- assert.strictEqual(err.errno, dns.NOTFOUND)
+ assert.strictEqual(err.errno, dns.NOTFOUND);
uv && assert.strictEqual(err.errno, 'ENOTFOUND');
done();
View
2  test/message/throw_custom_error.js
@@ -28,6 +28,6 @@ var assert = require('assert');
common.error('before');
// custom error throwing
-throw { name: 'MyCustomError', message: 'This is a custom message' };
+throw { name: 'MyCustomError', message: 'This is a custom message' }
common.error('after');
View
2  test/message/throw_non_error.js
@@ -28,6 +28,6 @@ var assert = require('assert');
common.error('before');
// custom error throwing
-throw { foo : 'bar' };
+throw { foo: 'bar' }
common.error('after');
View
4 test/pummel/test-http-upload-timeout.js
@@ -36,7 +36,7 @@ server.on('request', function(req, res) {
req.on('end', function() {
connections--;
res.writeHead(200);
- res.end("done\n");
+ res.end('done\n');
if (connections == 0) {
server.close();
}
@@ -51,7 +51,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
var request = http.request({
port: common.PORT,
method: 'POST',
- path: '/'
+ path: '/'
});
function ping() {
View
16 test/pummel/test-https-large-response.js
@@ -37,12 +37,12 @@ var reqCount = 0;
var body = '';
process.stdout.write('build body...');
-for (var i = 0; i < 1024*1024; i++) {
+for (var i = 0; i < 1024 * 1024; i++) {
body += 'hello world\n';
}
process.stdout.write('done\n');
-var server = https.createServer(options, function (req, res) {
+var server = https.createServer(options, function(req, res) {
reqCount++;
console.log('got request');
res.writeHead(200, { 'content-type': 'text/plain' });
@@ -52,23 +52,23 @@ var server = https.createServer(options, function (req, res) {
var count = 0;
var gotResEnd = false;
-server.listen(common.PORT, function () {
+server.listen(common.PORT, function() {
https.get({ port: common.PORT }, function(res) {
- console.log("response!");
+ console.log('response!');
res.on('data', function(d) {
process.stdout.write('.');
count += d.length;
res.pause();
- process.nextTick(function () {
+ process.nextTick(function() {
res.resume();
});
});
res.on('end', function(d) {
process.stdout.write('\n');
- console.log("expected: ", body.length);
- console.log(" got: ", count);
+ console.log('expected: ', body.length);
+ console.log(' got: ', count);
server.close();
gotResEnd = true;
});
@@ -76,7 +76,7 @@ server.listen(common.PORT, function () {
});
-process.on('exit', function () {
+process.on('exit', function() {
assert.equal(1, reqCount);
assert.equal(body.length, count);
assert.ok(gotResEnd);
View
6 test/pummel/test-net-write-callbacks.js
@@ -28,11 +28,11 @@ var N = 500000;
var server = net.Server(function(socket) {
socket.on('data', function(d) {
- console.error("got %d bytes", d.length);
+ console.error('got %d bytes', d.length);
});
socket.on('end', function() {
- console.error("end");
+ console.error('end');
socket.destroy();
server.close();
});
@@ -43,7 +43,7 @@ server.listen(common.PORT, function() {
client.on('connect', function() {
for (var i = 0; i < N; i++) {
- client.write("hello world", function() {
+ client.write('hello world', function() {
cbcount++;
});
}
View
17 test/pummel/test-next-tick-loops-quick.js
@@ -28,19 +28,20 @@ var assert = require('assert');
// Regression test GH-511: https://github.com/ry/node/issues/issue/511
// Make sure nextTick loops quickly
-setTimeout(function () {
- t = Date.now() - t;
- STOP = 1;
- console.log(["ctr: ",ctr, ", t:", t, "ms -> ", (ctr/t).toFixed(2), "KHz"].join(''));
- assert.ok(ctr > 1000);
+setTimeout(function() {
+ t = Date.now() - t;
+ STOP = 1;
+ console.log(['ctr: ', ctr, ', t:', t, 'ms -> ', (ctr / t).toFixed(2), 'KHz']
+ .join(''));
+ assert.ok(ctr > 1000);
}, 2000);
var ctr = 0;
var STOP = 0;
-var t = Date.now()+ 2;
-while (t > Date.now()) ; //get in sync with clock
+var t = Date.now() + 2;
+while (t > Date.now()); //get in sync with clock
-(function foo () {
+(function foo() {
if (STOP) return;
process.nextTick(foo);
ctr++;
View
6 test/pummel/test-tls-throttle.js
@@ -33,7 +33,7 @@ var fs = require('fs');
var body = '';
process.stdout.write('build body...');
-for (var i = 0; i < 1024*1024; i++) {
+for (var i = 0; i < 1024 * 1024; i++) {
body += 'hello world\n';
}
process.stdout.write('done\n');
@@ -62,7 +62,7 @@ server.listen(common.PORT, function() {
recvCount += d.length;
client.pause();
- process.nextTick(function () {
+ process.nextTick(function() {
client.resume();
});
});
@@ -82,7 +82,7 @@ function displayCounts() {
}
-var timeout = setTimeout(displayCounts, 10*1000);
+var timeout = setTimeout(displayCounts, 10 * 1000);
process.on('exit', function() {
View
6 test/pummel/test-vm-memleak.js
@@ -28,21 +28,21 @@ var maxMem = 0;
var interval = setInterval(function() {
try {
require('vm').runInNewContext('throw 1;');
- } catch(e) {
+ } catch (e) {
}
var rss = process.memoryUsage().rss;
maxMem = Math.max(rss, maxMem);
- if (Date.now() - start > 5*1000) {
+ if (Date.now() - start > 5 * 1000) {
// wait 10 seconds.
clearInterval(interval);
}
}, 1);
process.on('exit', function() {
- console.error('max mem: %dmb', Math.round(maxMem / (1024*1024)));
+ console.error('max mem: %dmb', Math.round(maxMem / (1024 * 1024)));
// make sure we stay below 100mb
assert.ok(maxMem < 50 * 1024 * 1024);
});
View
22 test/simple/test-assert.js
@@ -196,22 +196,22 @@ assert.doesNotThrow(function() {assert.ifError()});
threw = false;
try {
assert.throws(
- function() {
- throw {};
- },
- Array
+ function() {
+ throw {}
+ },
+ Array
);
-} catch(e) {
+} catch (e) {
threw = true;
}
-assert.ok(threw, "wrong constructor validation");
+assert.ok(threw, 'wrong constructor validation');
// use a RegExp to validate error message
a.throws(makeBlock(thrower, TypeError), /test/);
// use a fn to validate error object
a.throws(makeBlock(thrower, TypeError), function(err) {
- if ( (err instanceof TypeError) && /test/.test(err)) {
+ if ((err instanceof TypeError) && /test/.test(err)) {
return true;
}
});
@@ -228,7 +228,7 @@ c.b = c;
var gotError = false;
try {
assert.deepEqual(b, c);
-} catch(e) {
+} catch (e) {
gotError = true;
}
@@ -257,12 +257,12 @@ testAssertionMessage(-Infinity, '"-Infinity"');
testAssertionMessage('', '""');
testAssertionMessage('foo', '"foo"');
testAssertionMessage([], '[]');
-testAssertionMessage([1,2,3], '[1,2,3]');
+testAssertionMessage([1, 2, 3], '[1,2,3]');
testAssertionMessage(/a/, '"/a/"');
testAssertionMessage(/abc/gim, '"/abc/gim"');
testAssertionMessage(function f() {}, '"function f() {}"');
testAssertionMessage({}, '{}');
-testAssertionMessage({a:undefined, b:null}, '{"a":"undefined","b":null}');
-testAssertionMessage({a:NaN, b:Infinity, c:-Infinity},
+testAssertionMessage({a: undefined, b: null}, '{"a":"undefined","b":null}');
+testAssertionMessage({a: NaN, b: Infinity, c: -Infinity},
'{"a":"NaN","b":"Infinity","c":"-Infinity"}');
View
95 test/simple/test-buffer.js
@@ -260,7 +260,8 @@ var f = new Buffer([0, 0, 0, 0, 0]);
assert.equal(f.length, 5);
var size = f.write('あいうえお', 'ucs2');
console.error('bytes written to buffer: %d (should be 4)', size);
-console.error('chars written to buffer: %d (should be 2)', Buffer._charsWritten);
+console.error('chars written to buffer: %d (should be 2)',
+ Buffer._charsWritten);
assert.equal(size, 4);
assert.equal(Buffer._charsWritten, 2);
assert.deepEqual(f, new Buffer([0x42, 0x30, 0x44, 0x30, 0x00]));
@@ -411,7 +412,7 @@ assert.equal(dot.toString('base64'), '//4uAA==');
// Writing base64 at a position > 0 should not mangle the result.
//