5.1.1 • Published 4 years ago

objnest v5.1.1

Weekly downloads
5,085
License
MIT
Repository
github
Last release
4 years ago

objnest

Build Status npm Version JS Standard

Convert nested object to flatten or expand.

{foo.bar: 'baz'} <=> {foo: {bar: 'baz'}}

Installation

npm install objnest --save

Usage

Flatten Object Properties

Convert nested object into flatten structure.

'use strict'

const objnest = require('objnest')
let flattened = objnest.flatten({
    'foo': {'bar': 'baz'}
})
console.log(flattened) // => {'foo.bar': 'baz'}

Expand Object Properties

Convert flattened object into nested structure.

'use strict'

const objnest = require('objnest')
let expanded = objnest.expand({
    'foo.bar': 'baz'
})
console.log(expanded) // => {foo: {bar: 'baz'}}

Tips

Handling Array

Brackets with numbers are parsed as array.

'use strict'

const objnest = require('objnest')
let flattened = objnest.flatten({
  'foo': { 'bar': [ 'baz0', 'baz1' ] }
})
console.log(flattened) // => {'foo.bar[0]': 'baz0', 'foo.bar[1]': 'baz1'}
'use strict'

const objnest = require('objnest')
let expanded = objnest.expand({
  'foo.bar[0]': 'baz0',
  'foo.bar[1]': 'baz1'
})
console.log(expanded) // => {foo: bar:['baz0', 'baz1']}}

License

This software is released under the MIT License.

@everything-registry/sub-chunk-2366the-secretthe-scene-basethe-locthe-demo-sitethe-dialogthe-storethe-templatesthe-scene-mixinsthe-component-demothe-calendar@leanscope/inspectionpuddingpudding-evaluatorsiftttgitconfig@the-/dialog@the-/component-demo@the-/lint@the-/loc@the-/facade-scope@the-/ui-demo@the-/ui-dialog@the-/ui-calendar@the-/store@the-/templates@the-/secret@the-/scene@the-/mixin-scene@zalastax/nolb-objn@teambit/gitconfigapeman-task-contrib-mkdirapeman-task-envapeman-task-execcliapeman-task-infraapeman-task-jadeapeman-task-contrib-mochaapeman-task-contrib-nodeunitapeman-task-contrib-sassapeman-task-contrib-taggitapeman-task-contrib-taskapeman-task-contrib-versionupapeman-task-docapeman-task-js-beautifyapeman-task-jsdocapeman-task-contrib-chmodapeman-task-contrib-concatapeman-task-contrib-copyapeman-task-contrib-coverallsapeman-task-contrib-cozapeman-task-contrib-execcliapeman-task-contrib-fmtjsonapeman-task-contrib-handybowerapeman-task-contrib-istanbulapeman-task-apiguideapeman-task-bowerapeman-task-concatapeman-task-contrib-apiguideapeman-task-contrib-jadeapeman-task-contrib-jsdocapeman-task-contrib-migrateapeman-react-viewapemanrestapeman-task-setupdbapeman-task-sharegitapeman-task-showapemanenvapemanlocaleape-tmplapeman-app-formapeman-app-oauthapeman-app-peerapeman-app-profileapeman-app-contrib-loggerapeman-app-contrib-req-formapeman-app-contrib-req-queryapeman-app-contrib-res-jsonapeman-app-contrib-servestaticapeman-app-bodyapeman-app-captchaapeman-app-contrib-urlrouterapeman-brws-requestapeman-bud-wikiapeman-demo-webaskconfigapeman-task-needapeman-task-nodeunitapeman-task-pushapeman-task-taggitapeman-task-taskapeman-task-treeapeman-task-watchapeman-task-wchapeman-ui-contrib-angular-accordioningapeman-ui-contrib-angular-arrayingapeman-ui-contrib-angular-assertingapeman-ui-contrib-angular-confirmingapeman-ui-contrib-angular-decoratingapeman-ui-contrib-angular-dialogingapeman-ui-contrib-angular-forming
5.1.1

4 years ago

5.1.0

5 years ago

5.0.10

6 years ago

5.0.8

6 years ago

5.0.6

6 years ago

5.0.5

6 years ago

5.0.4

7 years ago

5.0.3

7 years ago

5.0.2

7 years ago

5.0.1

7 years ago

5.0.0

7 years ago

4.1.4

7 years ago

4.1.3

7 years ago

4.1.2

7 years ago

4.1.1

7 years ago

4.1.0

7 years ago

4.0.2

7 years ago

4.0.1

7 years ago

4.0.0

8 years ago

3.0.9

9 years ago

3.0.8

9 years ago

3.0.7

9 years ago

3.0.6

9 years ago

3.0.5

9 years ago

3.0.3

9 years ago

3.0.2

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.0.7

9 years ago

2.0.6

9 years ago

2.0.5

9 years ago

2.0.4

9 years ago

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.2.4

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago