docs: function flatten( arr, opts ) {
  	var isMatrix = false,
  		depth = Number.POSITIVE_INFINITY,
  		copy = false,
  		out,
  		fcn,
  		d;
  
  	if ( !isArray( arr ) ) {
  		throw new TypeError( 'flatten()::invalid input argument. Must provide an array. Value: `' + arr + '`.' );
  	}
  	if ( arguments.length > 1 ) {
  		if ( !isObject( opts ) ) {
  			throw new TypeError( 'flatten()::invalid input argument. Options argument must be an object. Value: `' + opts + '`.' );
  		}
  		if ( opts.hasOwnProperty( 'matrix' ) ) {
  			isMatrix = opts.matrix;
  			if ( !isBoolean( isMatrix ) ) {
  				throw new TypeError( 'flatten()::invalid option. Matrix option must be a boolean primitive. Option: `' + isMatrix + '`.' );
  			}
  		}
  		if ( opts.hasOwnProperty( 'depth' ) ) {
  			depth = opts.depth;
  			if ( !isNonNegativeInteger( depth ) ) {
  				throw new TypeError( 'flatten()::invalid option. Depth option must be a nonnegative integer. Option: `' + depth + '`.' );
  			}
  		}
  		if ( opts.hasOwnProperty( 'copy' ) ) {
  			copy = opts.copy;
  			if ( !isBoolean( copy ) ) {
  				throw new TypeError( 'flatten()::invalid option. Copy option must be a boolean primitive. Option: `' + copy + '`.' );
  			}
  		}
  	}
  	if ( depth === 0 ) {
  		out = arr;
  	}
  	else if ( isMatrix ) {
  		d = dims( arr, [], depth );
  		fcn = createMatrixFcn( d );
  		out = fcn( arr );
  	}
  	else {
  		out = recurse( [], arr, depth );
  	}
  	if ( copy ) {
  		return createCopy( out );
  	}
  	return out;
  }