You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

unwinder

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unwinder

Flattens objects

1.0.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Unwind

The unwind module copies deep objects to the first level.

What it does

If the original object is:
	{"first": {"second": {"third" : "data"}}}
Unwind will return an object like:
	{
		"first": {"second": {"third" : "data"}},
		"second": {"third" : "data"},
		"third" : "data"
	}

Why flatten it this way and not move everything to the first level?

We found use cases in which we wanted to preserve each attribute with its associated value, but needed each subsequent value to be accessible on the first level. In particular this improves validation checking with Smalley.

Examples

	npm install -g unwind
	npm install --save unwind
	var unwind   = require('unwind'),
		yourObj  = {"first": {"second": "data"}}
	
	unwind.flatten(yourObj, function(err, results) {
		if(err)
			//handle your error...	
		else
			//do something awesome with the results...
	}); 

outputs

	$meanMachine> {first: {second: data}, second: data}

Keywords

flatten

FAQs

Package last updated on 16 Jun 2015

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