netjsongraph.js icon indicating copy to clipboard operation
netjsongraph.js copied to clipboard

Changes enhance the code's robustness, usability, and maintainability while ensuring it can handle more complex data structures effectively. #<297>

Open Unnati-Gupta24 opened this issue 1 year ago • 0 comments

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

  1. Error Handling: Replaced console.error with throw new Error(...) for better error management.

  2. Input Validation: Added a validateNodes method to ensure input data is valid before processing.

  3. Performance Optimization: Used a Set in arrayDeduplication for tracking duplicates instead of an array.

  4. Support for Nested Properties: Enhanced arrayDeduplication to handle nested properties using dot notation via getValueByPath.

  5. Custom Key Generation: Allowed users to provide a custom key generation function in arrayDeduplication.

  6. Documentation Improvements: Updated JSDoc comments for clarity and added examples where appropriate.

Screenshot

Please include any relevant screenshots.

Screenshot

Please include any relevant screenshots.

Unnati-Gupta24 avatar Oct 04 '24 16:10 Unnati-Gupta24