Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(): flatten object #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

n33pm
Copy link

@n33pm n33pm commented Jun 1, 2022

const data = JSON.parse(`{
    "x": {
        "y": {
            "z": "test"
        }
    },
    "y": "test"
}`)
flattenObjectKeys(data, data, "")
console.debug(data)

Output

{
    "x.y.z": "test",
    "y": "undefined"
}

Expected

const data = JSON.parse(`{
    "x": {
        "y": {
            "z": "test"
        }
    },
    "y": "test"
}`)
console.debug(flattenObjectKeys(data, ""))

Output

{
    "x.y.z": "test",
    "y": "test"
}

@vthibault
Copy link
Member

Hi @n33pm,
Nice catch, thanks for the fix ! Is it possible for you to add a test ?

@vthibault vthibault added the bug Something isn't working label Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants