Skip to content

Virtualix-LTD/unflatn

 
 

Repository files navigation

unflatn

A fork of unflatten. Forked to address security issues in the original project, which appears to be abandoned.

For existing users of unflatten, the call signature remains the same.

npm version Coverage Status License

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'
    }
  }
}
*/

Install

npm i unflatn
yarn add unflatn
pnpm add unflatn

About

Opposite of flatten-obj

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%