function factory( dims, options ) {
	var copyFLG;
	var flatten;
	if ( !isPositiveIntegerArray( dims ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be an array of positive integers. Value: `%s`.', dims ) );
	}
	copyFLG = defaults.copy;
	if ( arguments.length > 1 ) {
		if ( !isObject( options ) ) {
			throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
		}
		if ( hasOwnProp( options, 'copy' ) ) {
			copyFLG = options.copy;
			if ( !isBoolean( copyFLG ) ) {
				throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', copyFLG ) );
			}
		}
	}
	flatten = genFcn( dims );
	if ( copyFLG ) {
		return wrapFlattenCopy( flatten );
	}
	return wrapFlatten( flatten );
}
Returns a function for flattening arrays having specified dimensions.

@param {PositiveIntegerArray} dims - dimensions
@param {Options} [options] - function options
@param {boolean} [options.copy=false] - boolean indicating whether to deep copy array elements
@throws {TypeError} first argument must be an array of positive integers
@throws {TypeError} options argument must be an object
@throws {TypeError} must provide valid options
@returns {Function} flatten function

@example
var flatten = factory( [2,2], {
    'copy': false
});

var out = flatten( [[1,2],[3,4]] );
// returns [ 1, 2, 3, 4 ]

out = flatten( [[5,6],[7,8]] );
// returns [ 5, 6, 7, 8 ]