The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

18 lines
407 B

  1. import Immutable from 'immutable';
  2. export const STORE_HYDRATE = 'STORE_HYDRATE';
  3. const convertState = rawState =>
  4. Immutable.fromJS(rawState, (k, v) =>
  5. Immutable.Iterable.isIndexed(v) ? v.toList() : v.toMap().mapKeys(x =>
  6. Number.isNaN(x * 1) ? x : x * 1));
  7. export function hydrateStore(rawState) {
  8. const state = convertState(rawState);
  9. return {
  10. type: STORE_HYDRATE,
  11. state
  12. };
  13. };