summaryrefslogtreecommitdiff
path: root/lib/buffer.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-04-16 11:29:35 -0700
committerJames M Snell <jasnell@gmail.com>2017-04-18 08:20:24 -0700
commit096508dfa97c6b10ed16db1f20da0cbe6ef808b0 (patch)
tree83e2fe2063656c9f74665cc3a213617b0d4db373 /lib/buffer.js
parent2e5188de928946c81266b149887d9b31111a5267 (diff)
downloadandroid-node-v8-096508dfa97c6b10ed16db1f20da0cbe6ef808b0.tar.gz
android-node-v8-096508dfa97c6b10ed16db1f20da0cbe6ef808b0.tar.bz2
android-node-v8-096508dfa97c6b10ed16db1f20da0cbe6ef808b0.zip
tools,lib: enable strict equality lint rule
Enablie a lint rule to require `===` and `!==` instead of `==` and `!=` except in some well-defined cases: * comparing against `null` as a shorthand for also checking for `undefined` * comparing the result of `typeof` * comparing literal values In cases where `==` or `!=` are being used as optimizations, use an ESLint comment to disable the `eqeqeq` rule for that line explicitly. I rather like this because it's a signal that the usage is intentional and not a mistake. PR-URL: https://github.com/nodejs/node/pull/12446 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/buffer.js')
-rw-r--r--lib/buffer.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/buffer.js b/lib/buffer.js
index 9163eb17c8..87bdfd2d95 100644
--- a/lib/buffer.js
+++ b/lib/buffer.js
@@ -192,6 +192,7 @@ Buffer.allocUnsafeSlow = function(size) {
// If --zero-fill-buffers command line argument is set, a zero-filled
// buffer is returned.
function SlowBuffer(length) {
+ // eslint-disable-next-line eqeqeq
if (+length != length)
length = 0;
assertSize(+length);
@@ -306,7 +307,7 @@ function fromObject(obj) {
return b;
}
- if (obj != undefined) {
+ if (obj != null) {
if (obj.length !== undefined || isAnyArrayBuffer(obj.buffer)) {
if (typeof obj.length !== 'number' || obj.length !== obj.length) {
return new FastBuffer();