1.0.7 • Published 6 years ago

q-flat v1.0.7

Weekly downloads
2,080
License
MIT
Repository
github
Last release
6 years ago

Flatten a nested object using query string syntax.

Installation

Npm

npm install q-flat

API

qflat.flatten(obj: any): any

  • Converts a nested object into a shallow one with keys using query string syntax.
import { flatten } from 'q-flat';

// Flatten nested objects.
flatten({ a: { b: { c: { 1 } } }); // -> { "a[b][c]": 1 }

// Even flatten arrays.
flatten({ a: [{ b: 1 }, { c: 2 }] }); // -> { 'a[0][b]': 1, 'a[1][c]': 2 }

Contributions

  • Use npm test to build and run tests.

Please feel free to create a PR!

1.0.7

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

9 years ago