Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function revive(state = Map()) {
let initalState = new (Record({
add: new Song,
edited: Map(),
latest: Map(),
map: Map(),
starred: Map(),
user: Map()
}));
initalState = addToMap(initalState, state.get('map') || Map());
initalState = addToLatest(initalState, state.get('latest') || Map());
return initalState;
}
function rolesByIdReducer(state = Map(), action) {
switch(action.type) {
case "LOAD_ROLES":
case "LOAD_ROLE":
case "ADD_ROLE":
case "EDIT_ROLE":
case "LOAD_USERS":
if(action.payload.status != "SUCCESS") {
break;
}
Object.values(action.payload.entities.roles).map(role => {
state = state.mergeIn([role.id], Map({
id: role.id,
name: role.name,
permissions: role.permissions
})
);
function tapsToMap(taps = []) {
return new Immutable.Map().withMutations((map) => {
taps.forEach(tap => map.set(tap.id, tap));
return map;
});
}
export function newsroomUi(state: Map = Map(), action: AnyAction): Map {
switch (action.type) {
case uiActions.ADD_GET_CMS_USER_DATA_FOR_ADDRESS:
return state.set(uiActions.GET_CMS_USER_DATA_FOR_ADDRESS, action.data);
case uiActions.ADD_PERSIST_CHARTER:
return state.set(uiActions.PERSIST_CHARTER, action.data);
default:
return state;
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
import { Map, List, Record } from 'immutable';
import * as Geometry from './geometry';
export var SNAP_POINT = 'SNAP_POINT';
export var SNAP_LINE = 'SNAP_LINE';
export var SNAP_SEGMENT = 'SNAP_SEGMENT';
export var SNAP_GRID = 'SNAP_GRID';
export var SNAP_GUIDE = 'SNAP_GUIDE';
export var SNAP_MASK = new Map({
SNAP_POINT: true,
SNAP_LINE: true,
SNAP_SEGMENT: true,
SNAP_GRID: false,
SNAP_GUIDE: true
});
var PointSnap = function (_Record) {
_inherits(PointSnap, _Record);
function PointSnap() {
_classCallCheck(this, PointSnap);
return _possibleConstructorReturn(this, (PointSnap.__proto__ || Object.getPrototypeOf(PointSnap)).apply(this, arguments));
}
merge: dispatch(2, anyArg(isAssociative), (o1, o2) => Map(o1).merge(Map(o2)), 'merge'),
mergeAll: dispatch(1, firstArg(isIndexed), l => l.reduce((acc, o) => acc.merge(o), Map()), 'mergeAll'),
export default function user (state = initialState, action) {
switch (action.type) {
case authActions.CHECK_LOGIN_SUCCESS:
return state.merge(Map(purge(action.user)));
case authActions.CHECK_LOGIN_FAILURE:
return initialState;
case authActions.FETCH_SIGNIN_SUCCESS:
return state.merge(Map(purge(action.user)));
case authActions.FETCH_SIGNIN_FAILURE:
return initialState;
case authActions.FETCH_SIGNIN_FACEBOOK_SUCCESS:
return state.merge(Map(purge(action.user)));
case authActions.FETCH_SIGNIN_FACEBOOK_FAILURE:
return initialState;
case actions.SAVE_BIO_SUCCESS:
return state.set('settings', action.settings);
case actions.COMMENTS_BY_USER_SUCCESS:
return state.set('myComments', action.comments);
case assetActions.MULTIPLE_ASSETS_SUCCESS:
return state.set('myAssets', action.assets);
case actions.LOGOUT_SUCCESS:
return initialState;
case 'APOLLO_MUTATION_RESULT':
switch (action.operationName) {
case 'ignoreUser':
return state.updateIn(['ignoredUsers'], (i) => i.add(action.variables.id));
case 'stopIgnoringUser':
return state.updateIn(['ignoredUsers'], (i) => i.delete(action.variables.id));
NullProcessor.prototype.process = function (object, propertyDescriptors) {
var processed = new Map(), keys = _.keysIn(object), value;
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var property = keys_1[_i];
value = object[property];
var cleanupResult = this.cleanupValue(value);
var cleanedValue = cleanupResult.cleanedValue;
var hasValue = cleanupResult.hasValue;
if (hasValue) {
processed.set(property, cleanedValue);
}
}
return processed.size > 0 ? immutable.Map(processed).toJS() : null;
};
NullProcessor.prototype.cleanupValue = function (value) {
function getInitialState(cards) {
return Map({
[Places.FOUNDATION]: Map({
HEARTS: List(),
SPADES: List(),
DIAMONDS: List(),
CLUBS: List()
}),
[Places.PILE]: getPiles(cards),
[Places.DECK]: Map({
upturned: List(cards.slice(-1)),
downturned: List(cards.slice(21, -1))
}),
winner: false
});
}
import createSagaMiddleware from 'redux-saga'
import thunk from 'redux-thunk'
import { Map as ImmutableMap } from 'immutable'
import { browserHistory } from 'react-router'
import { routerMiddleware } from 'react-router-redux'
import { createStore, applyMiddleware, compose } from 'redux'
import { combineReducers } from 'redux-immutable'
import sagas from '../sagas/root'
import socket from '../middleware/socket'
const routerMiddlewareWithHistory = routerMiddleware(browserHistory)
const rootReducer = combineReducers(reducers)
const initialState = ImmutableMap()
const sagaMiddleware = createSagaMiddleware()
const store = createStore(
rootReducer,
initialState,
compose(
applyMiddleware(sagaMiddleware, thunk, socket, routerMiddlewareWithHistory),
'production' !== process.env.NODE_ENV && global.devToolsExtension ?
global.devToolsExtension() :
f => f
)
)
sagaMiddleware.run(sagas)
if ('production' !== process.env.NODE_ENV && module.hot) {