From 6030ba45010b289da744d4d8f8b722377a5a8bf6 Mon Sep 17 00:00:00 2001 From: Samy Pesse Date: Thu, 3 Nov 2016 00:54:44 +0100 Subject: [PATCH] Change export of "is-dev" to be a constant to improve code compilation --- src/components/node.js | 4 ++-- src/utils/is-dev.js | 8 +++----- src/utils/warning.js | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/node.js b/src/components/node.js index aa4aee459..c69950d97 100644 --- a/src/components/node.js +++ b/src/components/node.js @@ -9,7 +9,7 @@ import Leaf from './leaf' import Void from './void' import scrollTo from '../utils/scroll-to' import warning from '../utils/warning' -import isDev from '../utils/is-dev' +import IS_DEV from '../utils/is-dev' /** * Debug. @@ -101,7 +101,7 @@ class Node extends React.Component { // If the node has changed, update. if (nextProps.node != this.props.node) { - if (!isDev() || !Immutable.is(nextProps.node, this.props.node)) { + if (!IS_DEV || !Immutable.is(nextProps.node, this.props.node)) { return true } else { warning('Encountered different references for identical node values in "shouldComponentUpdate". Check that you are preserving references for the following node:\n', nextProps.node) diff --git a/src/utils/is-dev.js b/src/utils/is-dev.js index bc869afc5..055227faa 100644 --- a/src/utils/is-dev.js +++ b/src/utils/is-dev.js @@ -1,4 +1,4 @@ -const __DEV__ = ( +const IS_DEV = ( typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production' @@ -6,9 +6,7 @@ const __DEV__ = ( /** * Return true if running slate in development - * @return {Boolean} dev + * @type {Boolean} */ -export default function isDev() { - return __DEV__ -} +export default IS_DEV diff --git a/src/utils/warning.js b/src/utils/warning.js index df0d483c0..6e4dba7e5 100644 --- a/src/utils/warning.js +++ b/src/utils/warning.js @@ -1,4 +1,4 @@ -import isDev from './is-dev' +import IS_DEV from './is-dev' /** * Log a development warning. @@ -6,7 +6,7 @@ import isDev from './is-dev' */ export default function warning(message, ...more) { - if (!isDev()) { + if (!IS_DEV) { return }