flatten the elements array
545256
function flattenElementsAr (ar) {
  return ar.reduce((acc, el) => {
    return isArray(el) ? [ ...acc, ...el ] : [ ...acc, el ]
  }, []).filter(notNull) // null means ignore
}
1276496
function flattenArray(array, filter, map, result) {
  let index = -1;
  while (++index < array.length) {
    const value = array[index];
    if (Array.isArray(value)) {
      flattenArray(value, filter, map, result);
    } else if (filter(value)) {
      result.push(map(value));
    }
  }
  return result;
}
143429
protected function flatten($array)
    {
        return array_reduce($array, function ($result, $item) {
            if (! is_array($item)) {
                return array_merge($result, [$item]);
            }

            return array_merge($result, $this->flatten($item));
        }, []);
    }
1195841
function flatten(files) {
        var ret = [];
        for (var i=0; i < files.length; i++) {
            ret.push(files[i].dst);
        }
        return ret;
    }
1213486
def flatten(lst):
    """"""
    def flatten_aux(item, accumulated):
        if type(item) != list:
            accumulated.append(item)
        else:
            for l in item:
                flatten_aux(l, accumulated)
    accumulated = []
    flatten_aux(lst,accumulated)
    return accumulated
745930
public function flatten()
	{
		$flatten = [];
		$this->flattenString('', $this->strings, $flatten);
		$this->strings = $flatten;
	}
703097
function flatten(data) {
        var dim = data[0][0].length, result = { vertices: new Array(), holes: new Array(), dimensions: dim }, holeIndex = 0;
        for (var i = 0; i < data.length; i++) {
            for (var j = 0; j < data[i].length; j++) {
                for (var d = 0; d < dim; d++)
                    result.vertices.push(data[i][j][d]);
            }
            if (i > 0) {
                holeIndex += data[i - 1].length;
                result.holes.push(holeIndex);
            }
        }
        return result;
    }
795146
def flatten(list_to_flatten):
    """"""

    def genflatten(lst):
        for elem in lst:
            if isinstance(elem, (list, tuple)):
                for x in flatten(elem):
                    yield x
            else:
                yield elem

    return list(genflatten(list_to_flatten))
814201
public function flatten( array $array, $preserve_keys = false ) {
		$return = [];
		array_walk_recursive( $array, function ( $v, $k ) use ( &$return, $preserve_keys ) {
			if ( $preserve_keys ) {
				$return[ $k ] = $v;
			} else {
				$return[] = $v;
			}
		} );

		return $return;
	}
232415
private function _flatten($array)
    {
        if (!is_array($array)) {
            // nothing to do if it's not an array
            return array($array);
        }
        $result = array();
        foreach ($array as $value) {
            // explode the sub-array, and add the parts
            $result = array_merge($result, $this->_flatten($value));
        }
        return $result;
    }
860016
function unshift(arr) {
    var items = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        items[_i - 1] = arguments[_i];
    }
    arr = arr.concat(flatten(items));
    return {
        array: arr,
        val: arr.length
    };
}
1254371
function() {
        return [].slice.call(arguments).reduce(function(a, b) {
          return a.concat(Array.isArray(b) ? funcifyr.flatten.apply(null, b) : b);
        }, []);
      }
800819
def flatten(self):
    """"""
    ls = [self.output]
    ls.extend(self.state)
    return ls
921872
function flatten(array, shallow) {

  shallow = shallow || false;

  if(!isArray(array)) {
    return array;
  }

  return (!shallow) ? depthFlatten(array, 0) :
    [].concat.apply([], array);
}
816309
def flatten(nested, containers=(list, tuple)):
    
    flat = list(nested) # handle iterators / generators
    i = 0
    while i < len(flat):
        while isinstance(flat[i], containers):
            if not flat[i]:
                # kill empty list
                flat.pop(i)

                # inspect new 'i'th element in outer loop
                i -= 1
                break
            else:
                flat[i:i + 1] = (flat[i])

        # 'i'th element is scalar, proceed
        i += 1

    return flat
6503
function flatten(keys) {
  var result = []
  var index = -1
  var length = keys.length

  while (++index < length) {
    if (own.call(alias, keys[index])) {
      result = result.concat(flatten(alias[keys[index]]))
    } else if (Array.isArray(keys[index])) {
      result = result.concat(keys[index])
    } else {
      result.push(keys[index])
    }
  }

  return result
}
231979
def flatten(self):
        
        blocksize = self.get_array()[0][0].get_width()
        width = self.get_width() * blocksize

        columnsNew = [[] for dummy in xrange(width)]

        for row in self.get_array():
            index = 0
            for submatrix in row:
                for column in submatrix.get_array(False):
                    columnsNew[index] += column
                    index += 1

        columnsFlat = sum(columnsNew, [])
        return Matrix(width, len(columnsNew[0]), columnsFlat, rowBased=False)