toss / es-toolkit

A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.
https://es-toolkit.slash.page
Other
7.07k stars 325 forks source link

flattenObject doesn't handle array of objects #816

Open mkatrenik opened 1 week ago

mkatrenik commented 1 week ago

Given this code

    const result = flattenObject({
      a: [1, { b: 2 }, 3],
    });

    expect(result).toEqual({
      'a.0': 1,
      'a.1.b': 2,
      'a.2': 3,
    });

nested object is not flattened

Screenshot 2024-11-12 at 19 47 16