flattern

Get a flat version of the object

Usage no npm install needed!

<script type="module">
  import flattern from 'https://cdn.skypack.dev/flattern';
</script>

README

flattern, flat objects

NPM version Build Status Coveralls Status

Get a flat version of the object

Installation

npm install flattern or yarn add flattern

Test the package

npm run test or yarn test

Usage

Example usage:

new Flattern({
    a: 1,
    b: 2,
    c: [3, 4],
    d: { e: 5, f: 6 },
    g: { h: { i: 7 } }
})

The response:

{
    a: 1,
    b: 2,
    "c.0": 3,
    "c.1": 4,
    "d.e": 5,
    "d.f": 6,
    "g.h.i": 7
}