Socket
Book a DemoInstallSign in
Socket

flattenize-object

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flattenize-object

Library to flatenize an object within another object

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

flatenize-object

A Nodejs Library to flattenize an object within another object

Installation

npm install flattenize-object --save

Usage

var flattenize = require('flattenize-object');
var obj = {
  "a": 1,
  "b": {
    "c": [
      2,
      3,
      4,
      5
    ],
    "d": 1,
    "e": "string",
    "inObj": {
      "f": 123,
      "g": [
        1,
        2,
        3
      ]
    }
  }
}

console.log(JSON.stringify(flatten(obj, 'b.inObj')));

{
  "a": 1,
  "b": {
    "c": [
      2,
      3,
      4,
      5
    ],
    "d": 1,
    "e": "string",
    "f": 123,
    "g": [
      1,
      2,
      3
    ]
  }
}


console.log(JSON.stringify(flatten(obj, 'b'), undefined, 2));

{
  "a": 1,
  "c": [
    2,
    3,
    4,
    5
  ],
  "d": 1,
  "e": "string",
  "f": 123,
  "g": [
    1,
    2,
    3
  ]
}


Keywords

flat

FAQs

Package last updated on 08 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts