Skip to content

Instantly share code, notes, and snippets.

@rob2d
rob2d / flatten.js
Last active Oct 23, 2018
Simple function to flatten an array. To easily verify results, download zip and run `test-cases.js` in Node
View flatten.js
/**
* Flatten any combination of nested ints/arrays
* in an array recursively into a flat array
* @param input {Array}
* @returns {Array}
*/
function flatten(input) {
let output = [];
for(let i = 0; i < input.length; i++) {
View outerHOCExample.jsx
outerJSSHOC(injectSheet(styleSheet)(({ classes, baseClasses })=>
( // baseClasses was injected by outerJSSHoc
<div className={classes.container}>
<div className={baseClasses.nonInterferingClass}>another style</div>
</div>
))