Skip to content

Commit fc61005

Browse files
committed
[Refactor] minor tweaks
1 parent 8d628e8 commit fc61005

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/to-buffer.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ var Buffer = require('safe-buffer').Buffer;
55
module.exports = function (thing, encoding, name) {
66
if (Buffer.isBuffer(thing)) {
77
return thing;
8-
} else if (typeof thing === 'string') {
8+
}
9+
if (typeof thing === 'string') {
910
return Buffer.from(thing, encoding);
10-
} else if (ArrayBuffer.isView(thing)) {
11+
}
12+
if (ArrayBuffer.isView(thing)) {
1113
return Buffer.from(thing.buffer);
1214
}
1315
throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView');
14-
1516
};

0 commit comments

Comments
 (0)