Permalink
Browse files

buffer: increase coverage by removing dead code

buffer.js:L196 `if (value == null)` guarantees `obj != null`
so L406+L418 are unnecessary.

PR-URL: #15100
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
Marcelo Gobelli authored and refack committed Aug 30, 2017
1 parent b12d779 commit 08984b26d351614fe4af0f582acb53c9b43dfda1
Showing with 7 additions and 9 deletions.
  1. +7 −9 lib/buffer.js
View
@@ -404,17 +404,15 @@ function fromObject(obj) {
return b;
}
if (obj != null) {
if (obj.length !== undefined || isAnyArrayBuffer(obj.buffer)) {
if (typeof obj.length !== 'number' || obj.length !== obj.length) {
return new FastBuffer();
}
return fromArrayLike(obj);
if (obj.length !== undefined || isAnyArrayBuffer(obj.buffer)) {
if (typeof obj.length !== 'number' || obj.length !== obj.length) {
return new FastBuffer();
}
return fromArrayLike(obj);
}
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
return fromArrayLike(obj.data);
}
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
return fromArrayLike(obj.data);
}
}

0 comments on commit 08984b2

Please sign in to comment.