1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 10:29:48 +02:00

Change export of "is-dev" to be a constant to improve code compilation

This commit is contained in:
Samy Pesse
2016-11-03 00:54:44 +01:00
parent 91f481ba8d
commit 6030ba4501
3 changed files with 7 additions and 9 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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
}