项目作者: matteoantoci

项目描述 :
Flatten / un-flatten nested objects
高级语言: JavaScript
项目地址: git://github.com/matteoantoci/lodash.flatten.git
创建时间: 2017-10-17T19:42:57Z
项目社区:https://github.com/matteoantoci/lodash.flatten

开源协议:MIT License

下载


lodash.flatten

Flatten / un-flatten nested objects

A simple utility based on lodash to flatten and un-flatten nested objects/arrays.

Useful when working with _.get and _.set

  1. un-flattened | flattened
  2. ---------------------------
  3. { foo: { bar: false } } <=> { 'foo.bar': false }
  4. { a: [{ b: ['c','d'] }] } <=> { 'a[0].b[0]': 'c', 'a[0].b[1]' : 'd' }
  5. [1,[2,[3,4],5],6] <=> { '[0]': 1, '[1].[0]': 2, '[1].[1].[0]': 3, '[1].[1].[1]': 4, '[1].[2]': 5, '[2]': 6 }