/* Flatten facial parts.
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
}
216295
function flatten(array, i) {
  i = i || 0;

  if(i >= array.length)
    return array;

  if(isArray(array[i])) {
    return flatten(array.slice(0,i)
      .concat(array[i], array.slice(i+1)), i);
  }
  return flatten(array, i+1);
}
1337522
function flattenInternal(output, element) {
  if (element) {
    element.forEach((obj) => {
      if (Array.isArray(obj)) {
        flattenInternal(output, obj);
      } else {
        output.push(obj);
      }
    });
  }
}
1097517
def subdivide(face, detail)
      cols = 2.0 ** detail
      a = prepare(@vertices[face.a])
      b = prepare(@vertices[face.b])
      c = prepare(@vertices[face.c])
      v = []

      # Construct all of the vertices for this subdivision.
      for i in 0..cols do
        v[i] = []

        aj = prepare(a.clone.lerp(c, i.to_f / cols.to_f))
        bj = prepare(b.clone.lerp(c, i.to_f / cols.to_f))
        rows = cols - i

        for j in 0..rows do
          v[i][j] = if j.zero? && i == cols
                      aj
                    else
                      prepare(aj.clone.lerp(bj, j.to_f / rows.to_f))
                    end
        end
      end

      # Construct all of the faces
      for i in 0...cols do
        for j in (0...(2 * (cols - i) - 1)) do
          k = j/2

          if j.even?
            make(
              v[i][k + 1],
              v[i + 1][k],
              v[i][k]
            )
          else
            make(
              v[i][k + 1],
              v[i + 1][k + 1],
              v[i + 1][k]
            )
          end
        end
      end
    end
745930
public function flatten()
	{
		$flatten = [];
		$this->flattenString('', $this->strings, $flatten);
		$this->strings = $flatten;
	}
576669
function flatten(matrix) {
    const res = [];

    // If the given matrix is not a matrix but a scalar.
    if (!Array.isArray(matrix)) {
        matrix = [
            [matrix]
        ];
    }

    matrix.forEach((row) => {
        // If the given matrix is a vector.
        if (!Array.isArray(row)) {
            row = [row];
        }

        row.forEach((elem) => {
            res.push(elem.real);
            res.push(elem.imag);
        });
    });
    return res;
}
1084529
function flatten(list) {
    return list.reduce(function (acc, item) {
        if (Array.isArray(item)) {
            return acc.concat(flatten(item));
        }
        else {
            return acc.concat(item);
        }
    }, []);
}
191914
function flatten(href) {
    href = normalize(href);
    if (href[0] == '/') {
        href = normalize(href.slice(1));
    }

    return href;
}
516225
function contoursTransform(contours, transforms) {
    if (!contours || !contours.length || !transforms || !transforms.length) {
        return contours;
    }

    contours.forEach(function (p) {
        for (var i = 0, l = transforms.length; i < l; i++) {
            var transform = transforms[i];
            var params = transform.params;
            switch (transform.name) {
                case 'translate':
                    pathAdjust(p, 1, 1, params[0], params[1]);
                    break;
                case 'scale':
                    pathAdjust(p, params[0], params[1]);
                    break;
                case 'matrix':
                    pathTransform(p, params[0], params[1], params[2], params[3], params[4], params[5]);
                    break;
            }
        }
    });

    return contours;
}
110445
protected function flattenParts(array $parts, array $flattened = [], $pre = '', $idx = 1, $full = true)
    {
        foreach ($parts as $part) {
            $key = $pre.$idx;
            $flattened[$key] = $part;
            if (isset($part->parts)) {
    			if ($part->type == TYPEMULTIPART) {
    				$flattened = $this->flattenParts($part->parts, $flattened, $key.'.', 1, false);
    			} elseif ($full) {
    				$flattened = $this->flattenParts($part->parts, $flattened, $key.'.');
    			} else {
    				$flattened = $this->flattenParts($part->parts, $flattened, $pre);
    			}
    			unset($flattened[$key]->parts);
    		}
    		$idx++;
        }

        return $flattened;
    }
609758
function buildSideFaces() {

		var layeroffset = 0;
		sidewalls( contour, layeroffset );
		layeroffset += contour.length;

		for ( h = 0, hl = holes.length; h < hl; h ++ ) {

			ahole = holes[ h ];
			sidewalls( ahole, layeroffset );

			//, true
			layeroffset += ahole.length;

		}

	}
1201020
function _flattenBufferIn () {
  if (this._isStreamInput()) {
    this.options.input.buffer = Buffer.concat(this.options.input.buffer);
  }
}
460996
function flattenAdditive(left, right) {
    var result = [];

    // Since .pop is faster than .shift we'll pop tasks from the end.
    var todo = [right, left];
    while (todo.length > 0) {
        match(todo.pop(), function(when) {
            when({
                type: 'BinaryExpression',
                operator: match.some('+', '-'),
                left: match.var('left'),
                right: match.var('right')
            }, function(vars) {
                todo.push(vars.right, vars.left);
            });

            when(match.var('operand'), function(vars) {
                result.push(vars.operand);
            });
        });
    }

    return result;
}
137315
public void reshape(int width , int height ) {
		if( padded == null ) {
			binary.reshape(width, height);
		} else {
			binary.reshape(width + 2, height + 2);
			binary.subimage(1, 1, width + 1, height + 1, subimage);
		}
	}
659570
function flatten(obj,callback) {
    let arr = [];
    let iDepth, oDepth = 0;
    let state = {identityDetection:true};
    recurse(obj,state,function(obj,key,state){
        let entry = {};
        entry.name = key;
        entry.value = obj[key];
        entry.path = state.path;
        entry.parent = obj;
        entry.key = key;
        if (callback) entry = callback(entry);
        if (entry) {
            if (state.depth > iDepth) {
                oDepth++;
            }
            else if (state.depth < iDepth) {
                oDepth--;
            }
            entry.depth = oDepth;
            iDepth = state.depth;
            arr.push(entry);
        }
    });
    return arr;
}
790395
function flatten(test) {
      return {
        title: test.title,
        duration: test.duration,
        err: test.err ? Object.assign({}, test.err) : null,
      };
    }
314890
function buildLidFaces() {

		if ( bevelEnabled ) {

			var layer = 0 ; // steps + 1
			var offset = vlen * layer;

			// Bottom faces

			for ( i = 0; i < flen; i ++ ) {

				face = faces[ i ];
				f3( face[ 2 ]+ offset, face[ 1 ]+ offset, face[ 0 ] + offset, true );

			}

			layer = steps + bevelSegments * 2;
			offset = vlen * layer;

			// Top faces

			for ( i = 0; i < flen; i ++ ) {

				face = faces[ i ];
				f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset, false );

			}

		} else {

			// Bottom faces

			for ( i = 0; i < flen; i++ ) {

				face = faces[ i ];
				f3( face[ 2 ], face[ 1 ], face[ 0 ], true );

			}

			// Top faces

			for ( i = 0; i < flen; i ++ ) {

				face = faces[ i ];
				f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps, false );

			}
		}

	}