'use strict';

// MODULES //

var isArray = require( '@stdlib/utils/is-array' );
var isArrayLike = require( '@stdlib/utils/is-array-like' );
var isTypedArrayLike = require( '@stdlib/utils/is-typed-array-like' );
var isInteger = require( '@stdlib/utils/is-integer' );
var appendArray = require( './append_array.js' );
var appendObject = require( './append_object.js' );
var appendTypedArray = require( './append_typed_array.js' );


// MAIN //

/**
* Adds elements from one collection to the end of another collection.
*
* @param {(Array|TypedArray|Object)} collection1 - collection
* @param {ArrayLike} collection2 - collection containing elements to add
* @throws {TypeError} first argument must be either an Array, Typed Array, or an array-like Object
* @throws {TypeError} second argument must be an array-like Object
* @returns {(Array|TypedArray|Object)} updated collection
*
* @example
* var arr = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
*
* arr = append( arr, [ 6.0, 7.0 ] );
* // returns [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
*
* @example
* var arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0 ]
*
* arr = append( arr, [ 6.0, 7.0 ] )
* // returns <Float64Array>[ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 ]
*/
function append( collection1, collection2 ) {
	if ( !isArrayLike( collection2 ) ) {
		throw new TypeError( 'invalid input argument. Second argument must be an array-like object. Value: `'+collection2+'`.' );
	}
	if ( isArray( collection1 ) ) {
		return appendArray( collection1, collection2 );
	}
	// Check for a typed-array-like object, as verifying actual typed arrays is expensive...
	if ( isTypedArrayLike( collection1 ) ) {
		return appendTypedArray( collection1, collection2 );
	}
	// Check for an array-like object...
	if (
		collection1 !== null &&
		typeof collection1 === 'object' &&
		typeof collection1.length === 'number' &&
		isInteger( collection1.length ) &&
		collection1.length >= 0
	) {
		return appendObject( collection1, collection2 );
	}
	throw new TypeError( 'invalid input argument. First argument must be either an Array, Typed Array, or an array-like Object. Value: `'+collection1+'`.' );
} // end FUNCTION append()


// EXPORTS //

module.exports = append;

@@ -699,38 +699,38 @@
 e either an 
-A
+a
 rray, 
-T
+t
 yped 
-A
+a
 rray, or an 
@@ -732,33 +732,33 @@
 r an array-like 
-O
+o
 bject%0A* @throws 
@@ -803,25 +803,25 @@
  array-like 
-O
+o
 bject%0A* @ret

Update description