Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
always(alwaysEmptyObject),
o(combineReducers, map(when(isPlainObject, object => recurseCombineReducers(object))))
);
const removeSuffix = o(head, split('@'));
/**
* Attempts to recursively remove suffixes from all keys of an object.
* If no suffix is present, the key will be skipped.
*
* @param {Object} object object to remove the suffixes from
* @returns {Object} object with suffixes removed
*/
export const removeSuffixFromKeys = o(
map(when(isPlainObject, object => removeSuffixFromKeys(object))),
mapKeys(removeSuffix)
);
/**
* Combines the reducers to create a new reducer. Uses `combineReducers` under the hood
* and removes all suffixes.
*
* @param {Object} injectedReducers recursively nested object with reducers as values
* @returns {Function} root reducer
*/
export const makeRootReducer = o(recurseCombineReducers, removeSuffixFromKeys);
/**
* Returns Redux state by namespace. Returns undefined if namespace is undefined.
*
* @param {?string} namespace optional namespace
* @param {Object} state Redux state
export default function withSuffixing(NextComponent) {
class WithSuffixing extends Component {
static propTypes = {
namespace: PropTypes.string,
};
static displayName = `WithSuffixing(${getDisplayName(NextComponent)})`;
id = counter++;
suffixKeys = o(
map(when(isPlainObject, object => this.suffixKeys(object))),
mapKeys(suffix(this.id))
);
render() {
return ;
}
}
return WithSuffixing;
}