crush-array
v1.0.0
Published
Crushing a deeply nested collection into a collection of flat objects
Downloads
1
Maintainers
Readme
Crush-array
Crush-array lets you completely flatten an object, duplicating each of its item anytime an array property is detected.
Starts with WHY
Crush-array's primarily intent is to escape the cascade of "each/if" that regularly happen when working with complex collections of objets and nested properties.
users.forEach(user => {
user.friends.forEach(friend => {
if (!friend.bestFriendId) {
}
})
})
Installing
Installation via npm is straightforward:
npm i dewind
Running the tests
cd yourself at the root of the project directory and then:
npm test
Examples
Explain what these tests test and why
Give an example
Contributing
Feel free to open a pull request if you like the module and wants to improve its quality No guidelines, just make sure the linter is all green as well as all adequate tests
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Inspired by the MongoDB's unwind function and common Flatten behavior