1.0.6 • Published 4 years ago

flat-er v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Flat-Er - Flattens stuff. That's it.

Table of Contents

Installation

npm

$ npm install --save flat-er

Usage

import fe  from 'flat-er'

const stuff = {
  pets: {
    dogs: [
      {
        name: 'douggie',
        goodBoy: true
      }
    ],
    cats: [
      {
        name: 'mrSocks',
        whiskers: true,
        litterBox: {
          clean: false
        },
        colors: [
          'black',
          'white'
        ]
      }
    ]
  }
}
const flattened = fe.flatten(stuff)

Result

{
  "pets.dogs.0.name": "douggie",
  "pets.dogs.0.goodBoy": true,
  "pets.cats.0.name": "mrSocks",
  "pets.cats.0.whiskers": true,
  "pets.cats.0.litterBox.clean": false,
  "pets.cats.0.colors.0": "black",
  "pets.cats.0.colors.1": "white"
}
1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago