1.0.3 • Published 9 years ago

unwinder v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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}
1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago