greena13/react-hotkeys

View on GitHub
src/helpers/logging/printComponent.js

Summary

Maintainability
A
0 mins
Test Coverage
function printComponent(component) {
  return JSON.stringify(
    component,
    componentAttributeSerializer,
    4
  );
}

function componentAttributeSerializer(key, value) {
  if (typeof value === 'function') {
    return value.toString();
  }

  return value;
}

export default printComponent;