15 lines
453 B
JavaScript
15 lines
453 B
JavaScript
const debugActionIgnore = (process.env.DEBUG_ACTION_IGNORE || '').split(',');
|
|
|
|
export function createDebugAction(debug, action) {
|
|
if (!debug.enabled || -1 !== debugActionIgnore.indexOf(action.type)) {
|
|
return undefined;
|
|
}
|
|
const debugAction = {type: action.type, payload: {...action.payload}};
|
|
if (!process.env.SILLY_DEBUG) {
|
|
for (const i in debugAction.payload) {
|
|
debugAction.payload[i] = '[...]';
|
|
}
|
|
}
|
|
return debugAction;
|
|
}
|