Skip to content

Commit 25be2a3

Browse files
soleboxMylesBorins
authored andcommitted
crypto: naming anonymous functions.
Ref: #8913 PR-URL: #8993
1 parent 66187fa commit 25be2a3

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
// Explicit conversion for backward compatibility.
8282
return this._handle.digest(`${outputEncoding}`);
@@ -123,12 +123,12 @@ function Cipher(cipher, password, options) {
123123

124124
util.inherits(Cipher, LazyTransform);
125125

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

131-
Cipher.prototype._flush = function(callback) {
131+
Cipher.prototype._flush = function _flush(callback) {
132132
try {
133133
this.push(this._handle.final());
134134
} catch (e) {
@@ -138,7 +138,7 @@ Cipher.prototype._flush = function(callback) {
138138
callback();
139139
};
140140

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

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

155155

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

@@ -166,22 +166,22 @@ Cipher.prototype.final = function(outputEncoding) {
166166
};
167167

168168

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

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

178178

179-
Cipher.prototype.setAuthTag = function(tagbuf) {
179+
Cipher.prototype.setAuthTag = function setAuthTag(tagbuf) {
180180
this._handle.setAuthTag(tagbuf);
181181
return this;
182182
};
183183

184-
Cipher.prototype.setAAD = function(aadbuf) {
184+
Cipher.prototype.setAAD = function setAAD(aadbuf) {
185185
this._handle.setAAD(aadbuf);
186186
return this;
187187
};
@@ -270,14 +270,14 @@ function Sign(algorithm, options) {
270270

271271
util.inherits(Sign, stream.Writable);
272272

273-
Sign.prototype._write = function(chunk, encoding, callback) {
273+
Sign.prototype._write = function _write(chunk, encoding, callback) {
274274
this._handle.update(chunk, encoding);
275275
callback();
276276
};
277277

278278
Sign.prototype.update = Hash.prototype.update;
279279

280-
Sign.prototype.sign = function(options, encoding) {
280+
Sign.prototype.sign = function sign(options, encoding) {
281281
if (!options)
282282
throw new Error('No key provided to sign');
283283

@@ -309,7 +309,7 @@ util.inherits(Verify, stream.Writable);
309309
Verify.prototype._write = Sign.prototype._write;
310310
Verify.prototype.update = Sign.prototype.update;
311311

312-
Verify.prototype.verify = function(object, signature, sigEncoding) {
312+
Verify.prototype.verify = function verify(object, signature, sigEncoding) {
313313
sigEncoding = sigEncoding || exports.DEFAULT_ENCODING;
314314
return this._handle.verify(toBuf(object), toBuf(signature, sigEncoding));
315315
};
@@ -477,14 +477,14 @@ function dhGetPrivateKey(encoding) {
477477
}
478478

479479

480-
DiffieHellman.prototype.setPublicKey = function(key, encoding) {
480+
DiffieHellman.prototype.setPublicKey = function setPublicKey(key, encoding) {
481481
encoding = encoding || exports.DEFAULT_ENCODING;
482482
this._handle.setPublicKey(toBuf(key, encoding));
483483
return this;
484484
};
485485

486486

487-
DiffieHellman.prototype.setPrivateKey = function(key, encoding) {
487+
DiffieHellman.prototype.setPrivateKey = function setPrivateKey(key, encoding) {
488488
encoding = encoding || exports.DEFAULT_ENCODING;
489489
this._handle.setPrivateKey(toBuf(key, encoding));
490490
return this;
@@ -602,19 +602,21 @@ function Certificate() {
602602
}
603603

604604

605-
Certificate.prototype.verifySpkac = function(object) {
605+
Certificate.prototype.verifySpkac = function verifySpkac(object) {
606606
return binding.certVerifySpkac(object);
607607
};
608608

609609

610-
Certificate.prototype.exportPublicKey = function(object, encoding) {
611-
return binding.certExportPublicKey(toBuf(object, encoding));
612-
};
610+
Certificate.prototype.exportPublicKey =
611+
function exportPublicKey(object, encoding) {
612+
return binding.certExportPublicKey(toBuf(object, encoding));
613+
};
613614

614615

615-
Certificate.prototype.exportChallenge = function(object, encoding) {
616-
return binding.certExportChallenge(toBuf(object, encoding));
617-
};
616+
Certificate.prototype.exportChallenge =
617+
function exportChallenge(object, encoding) {
618+
return binding.certExportChallenge(toBuf(object, encoding));
619+
};
618620

619621

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

0 commit comments

Comments
 (0)