Skip to content

Commit cfa2b87

Browse files
TrottMylesBorins
authored andcommittedFeb 1, 2017
test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which they are being assigned. That also seems to be the practice in a series of PRs currently being evaluated that name currently-anonymous functions. This change applies that rule to instances in the code base that don't comply with that practice. This will be enforceable with a lint rule once we upgrade to ESLint 3.8.0. PR-URL: #9113 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent 432cb1b commit cfa2b87

11 files changed

+17
-17
lines changed
 

‎lib/_stream_wrap.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function QueueItem(type, req) {
159159
this.next = this;
160160
}
161161

162-
StreamWrap.prototype._enqueue = function enqueue(type, req) {
162+
StreamWrap.prototype._enqueue = function _enqueue(type, req) {
163163
const item = new QueueItem(type, req);
164164
if (this._list === null) {
165165
this._list = item;
@@ -174,7 +174,7 @@ StreamWrap.prototype._enqueue = function enqueue(type, req) {
174174
return item;
175175
};
176176

177-
StreamWrap.prototype._dequeue = function dequeue(item) {
177+
StreamWrap.prototype._dequeue = function _dequeue(item) {
178178
assert(item instanceof QueueItem);
179179

180180
var next = item.next;

‎lib/_stream_writable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function WritableState(options, stream) {
118118
this.corkedRequestsFree = new CorkedRequest(this);
119119
}
120120

121-
WritableState.prototype.getBuffer = function writableStateGetBuffer() {
121+
WritableState.prototype.getBuffer = function getBuffer() {
122122
var current = this.bufferedRequest;
123123
var out = [];
124124
while (current) {

‎lib/_tls_legacy.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ CryptoStream.prototype.init = function init() {
142142
};
143143

144144

145-
CryptoStream.prototype._write = function write(data, encoding, cb) {
145+
CryptoStream.prototype._write = function _write(data, encoding, cb) {
146146
assert(this._pending === null);
147147

148148
// Black-hole data
@@ -223,7 +223,7 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
223223
};
224224

225225

226-
CryptoStream.prototype._writePending = function writePending() {
226+
CryptoStream.prototype._writePending = function _writePending() {
227227
const data = this._pending;
228228
const encoding = this._pendingEncoding;
229229
const cb = this._pendingCallback;
@@ -235,7 +235,7 @@ CryptoStream.prototype._writePending = function writePending() {
235235
};
236236

237237

238-
CryptoStream.prototype._read = function read(size) {
238+
CryptoStream.prototype._read = function _read(size) {
239239
// XXX: EOF?!
240240
if (!this.pair.ssl) return this.push(null);
241241

‎lib/_tls_wrap.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ proxiedMethods.forEach(function(name) {
316316
};
317317
});
318318

319-
tls_wrap.TLSWrap.prototype.close = function closeProxy(cb) {
319+
tls_wrap.TLSWrap.prototype.close = function close(cb) {
320320
let ssl;
321321
if (this.owner) {
322322
ssl = this.owner.ssl;
@@ -369,10 +369,10 @@ TLSSocket.prototype._wrapHandle = function(wrap) {
369369
res._secureContext = context;
370370
res.reading = handle.reading;
371371
Object.defineProperty(handle, 'reading', {
372-
get: function readingGetter() {
372+
get: function get() {
373373
return res.reading;
374374
},
375-
set: function readingSetter(value) {
375+
set: function set(value) {
376376
res.reading = value;
377377
}
378378
});

‎lib/domain.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Domain.prototype._disposed = undefined;
5858

5959

6060
// Called by process._fatalException in case an error was thrown.
61-
Domain.prototype._errorHandler = function errorHandler(er) {
61+
Domain.prototype._errorHandler = function _errorHandler(er) {
6262
var caught = false;
6363
var self = this;
6464

‎lib/fs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ fs.truncate = function(path, len, callback) {
697697
fs.open(path, 'r+', function(er, fd) {
698698
if (er) return callback(er);
699699
var req = new FSReqWrap();
700-
req.oncomplete = function ftruncateCb(er) {
700+
req.oncomplete = function oncomplete(er) {
701701
fs.close(fd, function(er2) {
702702
callback(er || er2);
703703
});

‎lib/net.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function Socket(options) {
189189
}
190190
util.inherits(Socket, stream.Duplex);
191191

192-
Socket.prototype._unrefTimer = function unrefTimer() {
192+
Socket.prototype._unrefTimer = function _unrefTimer() {
193193
for (var s = this; s !== null; s = s._parent)
194194
timers._unrefActive(s);
195195
};

‎test/parallel/test-child-process-spawn-typeerror.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ assert.throws(function() {
5757
// Argument types for combinatorics
5858
const a = [];
5959
const o = {};
60-
const c = function callback() {};
60+
const c = function c() {};
6161
const s = 'string';
6262
const u = undefined;
6363
const n = null;

‎test/parallel/test-http-client-readable.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FakeAgent.prototype.createConnection = function createConnection() {
1515
var s = new Duplex();
1616
var once = false;
1717

18-
s._read = function read() {
18+
s._read = function _read() {
1919
if (once)
2020
return this.push(null);
2121
once = true;
@@ -27,7 +27,7 @@ FakeAgent.prototype.createConnection = function createConnection() {
2727
};
2828

2929
// Blackhole
30-
s._write = function write(data, enc, cb) {
30+
s._write = function _write(data, enc, cb) {
3131
cb();
3232
};
3333

‎test/parallel/test-repl-persistent-history.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ const tests = [
176176
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
177177
},
178178
{ // Make sure this is always the last test, since we change os.homedir()
179-
before: function mockHomedirFailure() {
179+
before: function before() {
180180
// Mock os.homedir() failure
181181
os.homedir = function() {
182182
throw new Error('os.homedir() failure');

‎test/pummel/test-tls-server-large-request.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Mediator() {
2727
}
2828
util.inherits(Mediator, stream.Writable);
2929

30-
Mediator.prototype._write = function write(data, enc, cb) {
30+
Mediator.prototype._write = function _write(data, enc, cb) {
3131
this.buf += data;
3232
setTimeout(cb, 0);
3333

0 commit comments

Comments
 (0)