<commit_before>export const RECEIVE = '@@redux-jsonapi/RECEIVE';
export const GET = '@@redux-jsonapi/GET';
export const POST = '@@redux-jsonapi/POST';
export const PUT = '@@redux-jsonapi/PUT';
export const PATCH = '@@redux-jsonapi/PATCH';
export const DELETE = '@@redux-jsonapi/DELETE';

const request = (method, payload = {}) => {
  return {
    type: method,
    payload,
  };
};

export const get = (resource, params = {}, headers = {}) => {
  return request(GET, { resource, params, headers });
};

export const post = (resource, params = {}, headers = {}) => {
  return request(POST, { resource, params, headers });
};

export const put = (resource, params = {}, headers = {}) => {
  return request(PUT, { resource, params, headers });
};

export const patch = (resource, params = {}, headers = {}) => {
  return request(PATCH, { resource, params, headers });
};

export const del = (resource, params = {}, headers = {}) => {
  return request(DELETE, { resource, params, headers });
};

export const receive = (resources) => {
  return {
    type: RECEIVE,
    payload: {
      resources,
    },
  };
};

function getInitialState() {
  return {};
}

function receiveReducer(state, { resources }) {
  return resources.reduce((nextState, entity) => {
    return {
      ...nextState,
      [entity.type]: {
        ...nextState[entity.type],
        [entity.id]: entity,<commit_msg>Camelize resource type in reducer<commit_after>import { camelize } from 'humps';

export const RECEIVE = '@@redux-jsonapi/RECEIVE';
export const GET = '@@redux-jsonapi/GET';
export const POST = '@@redux-jsonapi/POST';
export const PUT = '@@redux-jsonapi/PUT';
export const PATCH = '@@redux-jsonapi/PATCH';
export const DELETE = '@@redux-jsonapi/DELETE';

const request = (method, payload = {}) => {
  return {
    type: method,
    payload,
  };
};

export const get = (resource, params = {}, headers = {}) => {
  return request(GET, { resource, params, headers });
};

export const post = (resource, params = {}, headers = {}) => {
  return request(POST, { resource, params, headers });
};

export const put = (resource, params = {}, headers = {}) => {
  return request(PUT, { resource, params, headers });
};

export const patch = (resource, params = {}, headers = {}) => {
  return request(PATCH, { resource, params, headers });
};

export const del = (resource, params = {}, headers = {}) => {
  return request(DELETE, { resource, params, headers });
};

export const receive = (resources) => {
  return {
    type: RECEIVE,
    payload: {
      resources,
    },
  };
};

function getInitialState() {
  return {};
}

function receiveReducer(state, { resources }) {
  return resources.reduce((nextState, resource) => {
    return {
      ...nextState,
      [camelize(resource.type)]: {
        ...nextState[camelize(resource.type)],
        [resource.id]: resource,
{'fraction_non_alphanumeric': 0.17828371278458843, 'fraction_numerical': 0.0, 'mean_word_length': 3.621359223300971, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '188744', 'n_tokens_mistral': 877, 'n_tokens_neox': 882, 'n_words': 229}