From 8073bdaa08f612075c233a788765c2e06dd5f600 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Tue, 10 Apr 2018 17:37:58 -0700 Subject: [PATCH] Tiny refactor; use `== null` Reviewed By: davidaurelio Differential Revision: D7575286 fbshipit-source-id: a9e0fc7ee5a15ce1eabb84759cf584df2acca008 --- .../worker/__tests__/constant-folding-plugin-test.js | 2 +- packages/metro/src/babel-bridge.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js b/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js index 8fb9d02a..e27d89f5 100644 --- a/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js +++ b/packages/metro/src/JSTransformer/worker/__tests__/constant-folding-plugin-test.js @@ -49,7 +49,7 @@ const babelOptions = { }; function normalize({code}): string { - if (code === undefined || code === null) { + if (code == null) { return 'FAIL'; } return transformSync(code, babelOptions).code; diff --git a/packages/metro/src/babel-bridge.js b/packages/metro/src/babel-bridge.js index 3021d337..4fd76194 100644 --- a/packages/metro/src/babel-bridge.js +++ b/packages/metro/src/babel-bridge.js @@ -219,7 +219,7 @@ function getPreset7() { ['transform-modules-commonjs', {strict: false, allowTopLevelThis: true}], ); - if (src !== null && src !== undefined) { + if (src != null) { addPluginsWhenSourceNeedsIt(src, plugins); }