Skip to content

Commit

Permalink
trailing whitespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs authored and ry committed Apr 11, 2010
1 parent 93913db commit 57fbb62
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ assert.equal = function equal(actual, expected, message) {
// with != assert.notEqual(actual, expected, message_opt);

assert.notEqual = function notEqual(actual, expected, message) {
if (actual == expected) {
if (actual == expected) {
fail(actual, expected, message, "!=", assert.notEqual);
}
};
Expand Down
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function stringToFlags(flag) {
case "r+": return process.O_RDWR;
case "w": return process.O_CREAT | process.O_TRUNC | process.O_WRONLY;
case "w+": return process.O_CREAT | process.O_TRUNC | process.O_RDWR;
case "a": return process.O_APPEND | process.O_CREAT | process.O_WRONLY;
case "a": return process.O_APPEND | process.O_CREAT | process.O_WRONLY;
case "a+": return process.O_APPEND | process.O_CREAT | process.O_RDWR;
default: throw new Error("Unknown file open flag: " + flag);
}
Expand Down Expand Up @@ -707,7 +707,7 @@ var writeStreamCloseWarning;
FileWriteStream.prototype.close = function (cb) {
if (!writeStreamCloseWarning) {
writeStreamCloseWarning = "FileWriteStream.prototype.close renamed to end()";
sys.error(writeStreamCloseWarning);
sys.error(writeStreamCloseWarning);
}
return this.end(cb);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/http_old.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ OutgoingMessage.prototype.sendHeaderLines = function (first_line, headers) {


OutgoingMessage.prototype.sendBody = function () {
throw new Error("sendBody() has been renamed to write(). " +
throw new Error("sendBody() has been renamed to write(). " +
"The 'body' event has been renamed to 'data' and " +
"the 'complete' event has been renamed to 'end'.");
};
Expand Down Expand Up @@ -338,7 +338,7 @@ function createIncomingMessageStream (connection, incoming_listener) {
field = null;
value = null;
});

// Only servers will get URL events.
connection.addListener("url", function (data) {
incoming.url += data;
Expand Down Expand Up @@ -580,7 +580,7 @@ http.Client.prototype.request = function (method, url, headers) {


exports.cat = function (url, encoding_, headers_) {
var encoding = 'utf8',
var encoding = 'utf8',
headers = {},
callback = null;

Expand All @@ -604,7 +604,7 @@ exports.cat = function (url, encoding_, headers_) {
}

var url = require("url").parse(url);

var hasHost = false;
for (var i in headers) {
if (i.toLowerCase() === "host") {
Expand All @@ -615,7 +615,7 @@ exports.cat = function (url, encoding_, headers_) {
if (!hasHost) headers["Host"] = url.hostname;

var content = "";

var client = exports.createClient(url.port || 80, url.hostname);
var req = client.request((url.pathname || "/")+(url.search || "")+(url.hash || ""), headers);

Expand Down
4 changes: 2 additions & 2 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function initStream (self) {
self.readable = false;

// Queue of buffers and string that need to be written to socket.
self._writeQueue = [];
self._writeQueue = [];
self._writeQueueEncoding = [];

self._writeWatcher = ioWatchers.alloc();
Expand Down Expand Up @@ -608,7 +608,7 @@ Stream.prototype.connect = function () {
initStream(self);
if (self.fd) throw new Error('Stream already opened');
if (!self._readWatcher) throw new Error('No readWatcher');

timeout.active(socket);

var port = parseInt(arguments[0]);
Expand Down
16 changes: 8 additions & 8 deletions lib/querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ QueryString.stringify = function (obj, sep, eq, name) {
if (isA(obj, null) || isA(obj, undefined) || typeof(obj) === 'function') {
return name ? encodeURIComponent(name) + eq : '';
}

if (isBool(obj)) obj = +obj;
if (isNumber(obj) || isString(obj)) {
return encodeURIComponent(name) + eq + encodeURIComponent(obj);
Expand All @@ -44,24 +44,24 @@ QueryString.stringify = function (obj, sep, eq, name) {
return s.join(sep);
}
// now we know it's an object.

// Check for cyclical references in nested objects
for (var i = stack.length - 1; i >= 0; --i) if (stack[i] === obj) {
throw new Error("querystring.stringify. Cyclical reference");
}

stack.push(obj);

var s = [];
var begin = name ? name + '[' : '';
var end = name ? ']' : '';
for (var i in obj) if (obj.hasOwnProperty(i)) {
var n = begin + i + end;
s.push(QueryString.stringify(obj[i], sep, eq, n));
}

stack.pop();

s = s.join(sep);
if (!s && name) return name + "=";
return s;
Expand Down Expand Up @@ -112,10 +112,10 @@ var pieceParser = function (eq) {
}
// ["foo[][bar][][baz]", "foo[][bar][]", "baz"]
var tail = sliced[2], head = sliced[1];

// array: key[]=val
if (!tail) return parsePiece(head, [val]);

// obj: key[subkey]=val
var ret = {};
ret[tail] = val;
Expand Down
28 changes: 14 additions & 14 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ exports.start = function (prompt) {
*/
function readline (cmd) {
cmd = trimWhitespace(cmd);

// Check to see if a REPL keyword was used. If it returns true,
// display next prompt and return.
if (parseREPLKeyword(cmd) === true) {
return;
}

// The catchall for errors
try {
buffered_cmd += "\n" + cmd;
// This try is for determining if the command is complete, or should
// continue onto the next line.
try {
buffered_cmd = convertToScope(buffered_cmd);

// Scope the readline with exports.scope to provide "local" vars
with (exports.scope) {
var ret = eval(buffered_cmd);
Expand All @@ -55,7 +55,7 @@ function readline (cmd) {
exports.writer(ret);
}
}

buffered_cmd = '';
} catch (e) {
if (!(e instanceof SyntaxError)) throw e;
Expand All @@ -69,23 +69,23 @@ function readline (cmd) {
}
buffered_cmd = '';
}

displayPrompt();
}


/**
* Used to display the prompt.
* Used to display the prompt.
*/
function displayPrompt () {
sys.print(buffered_cmd.length ? '... ' : exports.prompt);
}

/**
* Used to parse and execute the Node REPL commands.
*
*
* @param {cmd} cmd The command entered to check
* @returns {Boolean} If true it means don't continue parsing the command
* @returns {Boolean} If true it means don't continue parsing the command
*/
function parseREPLKeyword (cmd) {
switch (cmd) {
Expand Down Expand Up @@ -115,9 +115,9 @@ function parseREPLKeyword (cmd) {

/**
* Trims Whitespace from a line.
*
*
* @param {String} cmd The string to trim the whitespace from
* @returns {String} The trimmed string
* @returns {String} The trimmed string
*/
function trimWhitespace (cmd) {
var matches = trimmer.exec(cmd);
Expand All @@ -130,24 +130,24 @@ function trimWhitespace (cmd) {
* Converts commands that use var and function <name>() to use the
* local exports.scope when evaled. This provides a local scope
* on the REPL.
*
*
* @param {String} cmd The cmd to convert
* @returns {String} The converted command
*/
function convertToScope (cmd) {
var matches;

// Replaces: var foo = "bar"; with: exports.scope.foo = bar;
matches = scopedVar.exec(cmd);
if (matches && matches.length == 3) {
return "exports.scope." + matches[1] + matches[2];
}

// Replaces: function foo() {}; with: foo = function foo() {};
matches = scopeFunc.exec(buffered_cmd);
if (matches && matches.length == 2) {
return matches[1] + " = " + buffered_cmd;
}

return cmd;
}
4 changes: 2 additions & 2 deletions lib/sys.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ exports.inspect = function (obj, showHidden, depth) {
} else {
base = "";
}

// Make dates with properties first say the date
if (value instanceof Date) {
base = ' ' + value.toUTCString();
Expand Down Expand Up @@ -160,7 +160,7 @@ exports.inspect = function (obj, showHidden, depth) {

return name + ": " + str;
});

var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
Expand Down
Loading

0 comments on commit 57fbb62

Please sign in to comment.