Skip to content

Commit 0a10d8e

Browse files
committed
Clean code.
1 parent 784ae53 commit 0a10d8e

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

internal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
'use strict';
2828

29-
const crypto = require('crypto');
29+
const Crypto = require('crypto');
3030
const Fs = require('fs');
3131
const ReadStream = Fs.ReadStream;
3232
const Stream = require('stream');
@@ -815,7 +815,7 @@ HttpFile.prototype.$$read = function() {
815815

816816
HttpFile.prototype.md5 = function(callback) {
817817
var self = this;
818-
var md5 = crypto.createHash('md5');
818+
var md5 = Crypto.createHash('md5');
819819
var stream = Fs.createReadStream(self.path);
820820
stream.on('data', (buffer) => md5.update(buffer));
821821
stream.on('error', function(error) {

utils.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,6 @@ exports.encode = function(str) {
14491449
return '';
14501450

14511451
var type = typeof(str);
1452-
14531452
if (type !== 'string')
14541453
str = str.toString();
14551454

@@ -1467,7 +1466,6 @@ exports.decode = function(str) {
14671466
return '';
14681467

14691468
var type = typeof(str);
1470-
14711469
if (type !== 'string')
14721470
str = str.toString();
14731471

@@ -1493,9 +1491,7 @@ exports.parseInt = function(obj, def) {
14931491
if (obj == null)
14941492
return def || 0;
14951493
var type = typeof(obj);
1496-
if (type === 'number')
1497-
return obj;
1498-
return (type !== 'string' ? obj.toString() : obj).parseInt();
1494+
return type === 'number' ? obj : (type !== 'string' ? obj.toString() : obj).parseInt();
14991495
};
15001496

15011497
exports.parseBool = exports.parseBoolean = function(obj, def) {

0 commit comments

Comments
 (0)