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

Support for flatObject #142

Closed
ngthuongdoan opened this issue Jul 9, 2024 · 4 comments
Closed

Support for flatObject #142

ngthuongdoan opened this issue Jul 9, 2024 · 4 comments

Comments

@ngthuongdoan
Copy link

Hi can I work on this issue

const obj = {
    "name": "test",
    "company": {
        "name": "Company A",
        "address": {
            "city": "Ohio",
            "country": "USA"
        }
    }
}

const separator = '.'
flatObject(obj, separator)
/*
{
    "name": "test",
    "company.name": "Company A",
    "company.address.city": "Ohio",
    "company.address.country": "USA",
}
*/
@raon0211
Copy link
Collaborator

raon0211 commented Jul 9, 2024

Sure!

For the documentation, you may only add the documentation for English.

@ngthuongdoan
Copy link
Author

ngthuongdoan commented Jul 11, 2024

Hey @raon0211 I wonder if we can use something like this

import { flatten } from "es-toolkit/object"
// or I need to rename it to differ from flattenArray
import { flattenObject } from "es-toolkit"

@ngthuongdoan
Copy link
Author

@raon0211 Can you take a look?

@drag0n-app
Copy link

add an optional to preserve arrays and their contents?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants