Changes enhance the code's robustness, usability, and maintainability while ensuring it can handle more complex data structures effectively. #<297>
Checklist
- [yes ] I have read the OpenWISP Contributing Guidelines.
- [ yes] I have manually tested the changes proposed in this pull request.
- [yes ] I have written new test cases for new code and/or updated existing tests for changes to existing code.
- [yes ] I have updated the documentation.
Reference to Existing Issue
Closes #
Please open a new issue if there isn't an existing issue yet.
Description of Changes
-
Error Handling: Replaced console.error with throw new Error(...) for better error management.
-
Input Validation: Added a validateNodes method to ensure input data is valid before processing.
-
Performance Optimization: Used a Set in arrayDeduplication for tracking duplicates instead of an array.
-
Support for Nested Properties: Enhanced arrayDeduplication to handle nested properties using dot notation via getValueByPath.
-
Custom Key Generation: Allowed users to provide a custom key generation function in arrayDeduplication.
-
Documentation Improvements: Updated JSDoc comments for clarity and added examples where appropriate.
Screenshot
Please include any relevant screenshots.
Screenshot
Please include any relevant screenshots.