1. (function() {
  2. // Configuration error suppressor for development.
  3. window.suppressConfigErrors = function(config, message) {
  4. // Check if config is valid. Handles missing or invalid values.
  5. if (!config) {
  6. console.warn(`Development: Missing config value: ${message}`);
  7. return;
  8. }
  9. // Example: Check for string values
  10. if (typeof config === 'string' && config.trim() === "") {
  11. console.warn(`Development: Empty string config value: ${message}`);
  12. return;
  13. }
  14. // Example: Check for number values
  15. if (typeof config === 'number' && isNaN(config)) {
  16. console.warn(`Development: Invalid number config value: ${message}`);
  17. return;
  18. }
  19. // Add more checks here for specific config value types and constraints.
  20. // You can customize the error messages as needed.
  21. // If all checks pass, the config value is considered valid.
  22. };
  23. //Example usage (for demonstration)
  24. window.suppressConfigErrors("someValue", "mySetting");
  25. window.suppressConfigErrors(null, "anotherSetting");
  26. window.suppressConfigErrors(0, "numberSetting");
  27. window.suppressConfigErrors("", "emptySetting");
  28. })();

Add your comment