Skip to content

fix(): flatten object#29

Open
n33pm wants to merge 1 commit intokoala-interactive:masterfrom
numero33:fix/flattenObject
Open

fix(): flatten object#29
n33pm wants to merge 1 commit intokoala-interactive:masterfrom
numero33:fix/flattenObject

Conversation

@n33pm
Copy link
Copy Markdown

@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
Copy Markdown
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