diff --git a/package.json b/package.json index ff5c234cd..e0e3c7a4e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ } ], "dependencies": { - "assert": "^1.3.0", "react-native-tabs": "^1.0.2" }, "devDependencies": { diff --git a/src/Actions.js b/src/Actions.js index 41c9dbb8d..4ba9ba53a 100644 --- a/src/Actions.js +++ b/src/Actions.js @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. * */ -import assert from 'assert'; +import { assert } from './Util'; import Scene from './Scene'; export const JUMP_ACTION = 'jump'; export const PUSH_ACTION = 'push'; diff --git a/src/Reducer.js b/src/Reducer.js index 5ac210ca7..ad8cd0332 100644 --- a/src/Reducer.js +++ b/src/Reducer.js @@ -19,7 +19,7 @@ import { REFRESH_ACTION, } from './Actions'; -import assert from 'assert'; +import { assert } from './Util'; import { getInitialState } from './State'; // WARN: it is not working correct. rewrite it. diff --git a/src/State.js b/src/State.js index b8be2a2b2..5ea1bba77 100644 --- a/src/State.js +++ b/src/State.js @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. * */ -import assert from 'assert'; +import { assert } from './Util'; function getStateFromScenes(route, scenes, props) { const getters = []; diff --git a/src/Util.js b/src/Util.js new file mode 100644 index 000000000..03ad54f9c --- /dev/null +++ b/src/Util.js @@ -0,0 +1,5 @@ +export function assert(expr, failDescription) { + if (!expr) { + throw new Error(`[react-native-router-flux] ${failDescription}`); + } +}