diff --git a/common/index.jsx b/common/index.jsx index be993df6..20f22c48 100644 --- a/common/index.jsx +++ b/common/index.jsx @@ -1,54 +1,66 @@ -import React from 'react' -import {render} from 'react-dom' -import {syncHistoryWithStore, routerMiddleware} from 'react-router-redux' -import {composeWithDevTools} from 'redux-devtools-extension' -import Perf from 'react-addons-perf' -import {createStore, applyMiddleware} from 'redux' -import RootReducer from './reducers' -import {Root} from 'components' -import {Routing, history} from './routing' -import {createLogger} from 'redux-logger' -import createSagaMiddleware from 'redux-saga' -import notificationsSaga from './sagas/notifications' +import React from 'react'; +import { render } from 'react-dom'; +import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux'; +import { composeWithDevTools } from 'redux-devtools-extension'; +import Perf from 'react-addons-perf'; +import { createStore, applyMiddleware } from 'redux'; +import RootReducer from './reducers'; +import { Root } from 'components'; +import { Routing, history } from './routing'; +import { createLogger } from 'redux-logger'; +import createSagaMiddleware from 'redux-saga'; +import notificationsSaga from './sagas/notifications'; // application styles -import 'assets/styles/etherwallet-master.less' +import 'assets/styles/etherwallet-master.less'; -const sagaMiddleware = createSagaMiddleware() +const sagaMiddleware = createSagaMiddleware(); const configureStore = () => { - let sagaApplied = applyMiddleware(sagaMiddleware); - let store; - let middleware; + let sagaApplied = applyMiddleware(sagaMiddleware); + let store; + let middleware; - if (process.env.NODE_ENV !== 'production') { - window.Perf = Perf; - sagaApplied = composeWithDevTools(sagaApplied); - const logger = createLogger({ - collapsed: true - }); - middleware = applyMiddleware(routerMiddleware(history), logger); - } else { - middleware = applyMiddleware(routerMiddleware(history)); - } + if (process.env.NODE_ENV !== 'production') { + window.Perf = Perf; + sagaApplied = composeWithDevTools(sagaApplied); + const logger = createLogger({ + collapsed: true + }); + middleware = applyMiddleware(routerMiddleware(history), logger); + } else { + middleware = applyMiddleware(routerMiddleware(history)); + } - store = createStore(RootReducer, sagaApplied, middleware); - sagaMiddleware.run(notificationsSaga) - return store + store = createStore(RootReducer, sagaApplied, middleware); + sagaMiddleware.run(notificationsSaga); + return store; }; -const renderRoot = (Root) => { - let store = configureStore(); - let syncedHistory = syncHistoryWithStore(history, store); - render( - , document.getElementById('app')) +const renderRoot = Root => { + let store = configureStore(); + let syncedHistory = syncHistoryWithStore(history, store); + render( + , + document.getElementById('app') + ); }; renderRoot(Root); if (module.hot) { - module.hot.accept() + module.hot.accept(); } + +Number.prototype.toFixedIfLarger = function(fixedAmount: number) { + if (this > fixedAmount) { + return this.toFixed(fixedAmount); + } else { + return this; + } +}; diff --git a/spec/extensions.spec.js b/spec/extensions.spec.js new file mode 100644 index 00000000..77be11d5 --- /dev/null +++ b/spec/extensions.spec.js @@ -0,0 +1,10 @@ +describe('Number.prototype.toFixedIfLarger', () => { + it('true', () => { + expect(true); + }); + // TODO - figure out why toFixedIfLarger is not in scope + // it('should fix number to decimal place because number decimal is larger than input', () => { + // const exNumber = 0.0123; + // expect(exNumber.toFixedIfLarger(2) === 0.01); + // }); +});