Skip to content

Commit 72f1c41

Browse files
soleboxjasnell
authored andcommitted
crypto: naming anonymous functions
Ref: #8913 PR-URL: #8993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent ea011eb commit 72f1c41

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

lib/crypto.js

+26-24
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,24 @@ function Hash(algorithm, options) {
5959

6060
util.inherits(Hash, LazyTransform);
6161

62-
Hash.prototype._transform = function(chunk, encoding, callback) {
62+
Hash.prototype._transform = function _transform(chunk, encoding, callback) {
6363
this._handle.update(chunk, encoding);
6464
callback();
6565
};
6666

67-
Hash.prototype._flush = function(callback) {
67+
Hash.prototype._flush = function _flush(callback) {
6868
this.push(this._handle.digest());
6969
callback();
7070
};
7171

72-
Hash.prototype.update = function(data, encoding) {
72+
Hash.prototype.update = function update(data, encoding) {
7373
encoding = encoding || exports.DEFAULT_ENCODING;
7474
this._handle.update(data, encoding);
7575
return this;
7676
};
7777

7878

79-
Hash.prototype.digest = function(outputEncoding) {
79+
Hash.prototype.digest = function digest(outputEncoding) {
8080
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
8181
return this._handle.digest(outputEncoding);
8282
};
@@ -122,12 +122,12 @@ function Cipher(cipher, password, options) {
122122

123123
util.inherits(Cipher, LazyTransform);
124124

125-
Cipher.prototype._transform = function(chunk, encoding, callback) {
125+
Cipher.prototype._transform = function _transform(chunk, encoding, callback) {
126126
this.push(this._handle.update(chunk, encoding));
127127
callback();
128128
};
129129

130-
Cipher.prototype._flush = function(callback) {
130+
Cipher.prototype._flush = function _flush(callback) {
131131
try {
132132
this.push(this._handle.final());
133133
} catch (e) {
@@ -137,7 +137,7 @@ Cipher.prototype._flush = function(callback) {
137137
callback();
138138
};
139139

140-
Cipher.prototype.update = function(data, inputEncoding, outputEncoding) {
140+
Cipher.prototype.update = function update(data, inputEncoding, outputEncoding) {
141141
inputEncoding = inputEncoding || exports.DEFAULT_ENCODING;
142142
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
143143

@@ -152,7 +152,7 @@ Cipher.prototype.update = function(data, inputEncoding, outputEncoding) {
152152
};
153153

154154

155-
Cipher.prototype.final = function(outputEncoding) {
155+
Cipher.prototype.final = function final(outputEncoding) {
156156
outputEncoding = outputEncoding || exports.DEFAULT_ENCODING;
157157
var ret = this._handle.final();
158158

@@ -165,21 +165,21 @@ Cipher.prototype.final = function(outputEncoding) {
165165
};
166166

167167

168-
Cipher.prototype.setAutoPadding = function(ap) {
168+
Cipher.prototype.setAutoPadding = function setAutoPadding(ap) {
169169
this._handle.setAutoPadding(ap);
170170
return this;
171171
};
172172

173-
Cipher.prototype.getAuthTag = function() {
173+
Cipher.prototype.getAuthTag = function getAuthTag() {
174174
return this._handle.getAuthTag();
175175
};
176176

177177

178-
Cipher.prototype.setAuthTag = function(tagbuf) {
178+
Cipher.prototype.setAuthTag = function setAuthTag(tagbuf) {
179179
this._handle.setAuthTag(tagbuf);
180180
};
181181

182-
Cipher.prototype.setAAD = function(aadbuf) {
182+
Cipher.prototype.setAAD = function setAAD(aadbuf) {
183183
this._handle.setAAD(aadbuf);
184184
};
185185

@@ -267,14 +267,14 @@ function Sign(algorithm, options) {
267267

268268
util.inherits(Sign, stream.Writable);
269269

270-
Sign.prototype._write = function(chunk, encoding, callback) {
270+
Sign.prototype._write = function _write(chunk, encoding, callback) {
271271
this._handle.update(chunk, encoding);
272272
callback();
273273
};
274274

275275
Sign.prototype.update = Hash.prototype.update;
276276

277-
Sign.prototype.sign = function(options, encoding) {
277+
Sign.prototype.sign = function sign(options, encoding) {
278278
if (!options)
279279
throw new Error('No key provided to sign');
280280

@@ -306,7 +306,7 @@ util.inherits(Verify, stream.Writable);
306306
Verify.prototype._write = Sign.prototype._write;
307307
Verify.prototype.update = Sign.prototype.update;
308308

309-
Verify.prototype.verify = function(object, signature, sigEncoding) {
309+
Verify.prototype.verify = function verify(object, signature, sigEncoding) {
310310
sigEncoding = sigEncoding || exports.DEFAULT_ENCODING;
311311
return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding));
312312
};
@@ -474,14 +474,14 @@ function dhGetPrivateKey(encoding) {
474474
}
475475

476476

477-
DiffieHellman.prototype.setPublicKey = function(key, encoding) {
477+
DiffieHellman.prototype.setPublicKey = function setPublicKey(key, encoding) {
478478
encoding = encoding || exports.DEFAULT_ENCODING;
479479
this._handle.setPublicKey(toBuf(key, encoding));
480480
return this;
481481
};
482482

483483

484-
DiffieHellman.prototype.setPrivateKey = function(key, encoding) {
484+
DiffieHellman.prototype.setPrivateKey = function setPrivateKey(key, encoding) {
485485
encoding = encoding || exports.DEFAULT_ENCODING;
486486
this._handle.setPrivateKey(toBuf(key, encoding));
487487
return this;
@@ -599,19 +599,21 @@ function Certificate() {
599599
}
600600

601601

602-
Certificate.prototype.verifySpkac = function(object) {
602+
Certificate.prototype.verifySpkac = function verifySpkac(object) {
603603
return binding.certVerifySpkac(object);
604604
};
605605

606606

607-
Certificate.prototype.exportPublicKey = function(object, encoding) {
608-
return binding.certExportPublicKey(toBuf(object, encoding));
609-
};
607+
Certificate.prototype.exportPublicKey =
608+
function exportPublicKey(object, encoding) {
609+
return binding.certExportPublicKey(toBuf(object, encoding));
610+
};
610611

611612

612-
Certificate.prototype.exportChallenge = function(object, encoding) {
613-
return binding.certExportChallenge(toBuf(object, encoding));
614-
};
613+
Certificate.prototype.exportChallenge =
614+
function exportChallenge(object, encoding) {
615+
return binding.certExportChallenge(toBuf(object, encoding));
616+
};
615617

616618

617619
exports.setEngine = function setEngine(id, flags) {

0 commit comments

Comments
 (0)