Skip to content

vigour-io/unflatten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unflatten

Build Status js-standard-style npm version Coverage Status

var obj = unflatten(subject, [opts])

Opposite of flatten-obj. Unflattens an object with delimited keys

  • subject (object) - Object that needs to be unflattened

  • [opts] (object|string|boolean) - Optional.

    • Provide a string as a shortcut for { separator: opts }
    • Provide a boolean as a shorcut for { objectMode: opts }
    • Provide an object to set both options { separator: '/', objectMode: true }
  • Available options:

  • separator (string) - defaults to '.'

  • objectMode (boolean) - defaults to false

  • return (object) obj - Nested Javascript object
const unflatten = require('unflatten')
unflatten({
  'a.b.c': 'd'
})
/*
{
  a: {
    b: {
      c: 'd'
    }
  }
}
*/