5.1.1 • Published 3 years ago

objnest v5.1.1

Weekly downloads
5,085
License
MIT
Repository
github
Last release
3 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-2366gitconfigevaljsonpudding-evaluatorpuddingsiftttthe-component-demothe-storethe-templatesthe-secretthe-scene-basethe-scene-mixinsthe-dialogthe-demo-sitethe-calendarthe-loc@leanscope/inspection@teambit/gitconfig@the-/dialog@the-/mixin-scene@the-/component-demo@the-/facade-scope@the-/lint@the-/loc@the-/ui-calendar@the-/ui-demo@the-/ui-dialog@the-/scene@the-/secret@the-/templates@the-/storebrequestapeman-react-viewapeman-task-apiguideapeman-task-bowerapeman-task-concatapeman-task-contrib-apiguideapeman-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-contrib-jadeapeman-task-contrib-jsdocapeman-task-contrib-migrateapeman-task-contrib-mkdirapeman-task-infraapeman-task-jadeapeman-task-js-beautifyapeman-task-jsdocapeman-task-needapeman-task-nodeunitapeman-task-setupdbapeman-task-sharegitapeman-task-showapeman-task-contrib-mochaapeman-task-contrib-nodeunitapeman-task-contrib-sassapeman-task-contrib-taggitapeman-task-contrib-taskapeman-task-contrib-versionupapeman-task-docapeman-task-envapeman-task-execcliapeman-task-pushapeman-brws-requestapeman-app-oauthapeman-app-peerapeman-app-profileapeman-bud-wikiapeman-demo-webapemanenvapemanlocaleapemanrestapeman-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-formingapeman-ui-contrib-angular-listingapeman-ui-contrib-angular-locatingapeman-task-taggitapeman-task-taskapeman-task-treeapeman-task-watchapeman-task-wchapeman-ui-contrib-angular-requestingapeman-ui-contrib-angular-scrollingapeman-ui-contrib-angular-spinningapeman-ui-contrib-angular-storagingapeman-ui-contrib-angular-tabbingapeman-ui-contrib-angular-timingapeman-ui-contrib-angular-toastingapeman-ui-contrib-angular-touching
5.1.1

3 years ago

5.1.0

3 years ago

5.0.10

5 years ago

5.0.8

5 years ago

5.0.6

5 years ago

5.0.5

5 years ago

5.0.4

5 years ago

5.0.3

6 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.1.4

6 years ago

4.1.3

6 years ago

4.1.2

6 years ago

4.1.1

6 years ago

4.1.0

6 years ago

4.0.2

6 years ago

4.0.1

6 years ago

4.0.0

7 years ago

3.0.9

8 years ago

3.0.8

8 years ago

3.0.7

8 years ago

3.0.6

8 years ago

3.0.5

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.0.7

8 years ago

2.0.6

8 years ago

2.0.5

8 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.2.4

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago