diff --git a/src/createAction.js b/src/createAction.js index 6a3f3042..5c39b419 100644 --- a/src/createAction.js +++ b/src/createAction.js @@ -1,7 +1,7 @@ import invariant from 'invariant'; import isFunction from './utils/isFunction'; import identity from './utils/identity'; -import isNull from './utils/isNull'; +import isNil from './utils/isNil'; export default function createAction( type, @@ -9,18 +9,18 @@ export default function createAction( metaCreator ) { invariant( - isFunction(payloadCreator) || isNull(payloadCreator), + isFunction(payloadCreator) || isNil(payloadCreator), 'Expected payloadCreator to be a function, undefined or null' ); const finalPayloadCreator = - isNull(payloadCreator) || payloadCreator === identity + isNil(payloadCreator) || payloadCreator === identity ? identity : (head, ...args) => head instanceof Error ? head : payloadCreator(head, ...args); const hasMeta = isFunction(metaCreator); - const typeString = type.toString(); + const typeString = String(type); const actionCreator = (...args) => { const payload = finalPayloadCreator(...args); diff --git a/src/utils/flattenWhenNode.js b/src/utils/flattenWhenNode.js index 3ee137f1..9c23f61b 100644 --- a/src/utils/flattenWhenNode.js +++ b/src/utils/flattenWhenNode.js @@ -11,7 +11,7 @@ export default predicate => ) { function connectNamespace(type) { if (!partialFlatActionType) return type; - const types = type.toString().split(ACTION_TYPE_DELIMITER); + const types = String(type).split(ACTION_TYPE_DELIMITER); const partials = partialFlatActionType.split(ACTION_TYPE_DELIMITER); return [] .concat(...partials.map(p => types.map(t => `${p}${namespace}${t}`))) diff --git a/src/utils/isNull.js b/src/utils/isNull.js deleted file mode 100644 index b7664b39..00000000 --- a/src/utils/isNull.js +++ /dev/null @@ -1 +0,0 @@ -export default value => value === null; diff --git a/src/utils/toString.js b/src/utils/toString.js index e33f21a6..428d1cad 100644 --- a/src/utils/toString.js +++ b/src/utils/toString.js @@ -1 +1 @@ -export default value => value.toString(); +export default value => String(value);