https://github.com/mrabdelaziz/nested-object-attribute-finder
A JavaScript function that allows you to find a nested object with a specific attribute name.
https://github.com/mrabdelaziz/nested-object-attribute-finder
breadth-first-search finder javascript nested-objects
Last synced: 6 months ago
JSON representation
A JavaScript function that allows you to find a nested object with a specific attribute name.
- Host: GitHub
- URL: https://github.com/mrabdelaziz/nested-object-attribute-finder
- Owner: MrAbdelaziz
- License: mit
- Created: 2023-05-16T00:27:10.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-16T00:47:00.000Z (over 2 years ago)
- Last Synced: 2025-03-29T19:11:03.968Z (10 months ago)
- Topics: breadth-first-search, finder, javascript, nested-objects
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nested Object Attribute Finder
A JavaScript function that allows you to find a nested object with a specific attribute name.
## Table of Contents
- [Introduction](#introduction)
- [Usage](#usage)
## Introduction
Finding a nested object with a specific attribute name can be a challenging task, especially when dealing with complex object hierarchies. The `findNestedObjectWithAttribute` function provides a simple solution to this problem. It uses a breadth-first search algorithm to traverse through the object and locate the nested object with the desired attribute.
## Usage
To use the `findNestedObjectWithAttribute` function, follow these steps:
1. Include the function code in your JavaScript file or project.
2. Call the function with the object to search within and the attribute name as parameters.
3. The function will return an object containing the path and value of the attribute if found, or `null` if not found.