'use strict';

// flatten arbitrarily nested array
// data NestedList a = Elem a | List [NestedList a]
// flatten :: NestedList a -> [a]
function flatten(arr) {
  const _flatten = function(p, c) {
    if (Array.isArray(c)) p = p.concat(c.reduce(_flatten, []));
    else p.push(c);
    return p;
  };

  return arr.reduce(_flatten, []);
}

'use strict';

// flatten arbitrarily nested array
// data NestedList a = Elem a | List [NestedList a]
// flatten :: NestedList a -> [a]
module.exports = function flatten(arr) {
  const _flatten = function(p, c) {
    if (Array.isArray(c)) p = p.concat(c.reduce(_flatten, []));
    else p.push(c);
    return p;
  };

  return arr.reduce(_flatten, []);
};

--- 
+++ 
@@ -3,7 +3,7 @@
 // flatten arbitrarily nested array
 // data NestedList a = Elem a | List [NestedList a]
 // flatten :: NestedList a -> [a]
-function flatten(arr) {
+module.exports = function flatten(arr) {
   const _flatten = function(p, c) {
     if (Array.isArray(c)) p = p.concat(c.reduce(_flatten, []));
     else p.push(c);
@@ -11,4 +11,4 @@
   };
 
   return arr.reduce(_flatten, []);
-}
+};
Remove all the module system junk
