'use strict';

// MODULES //

var isArrayArray = require( '@stdlib/utils/is-array-array' );


// MAIN //

/**
* Creates an object from an array of key-value pairs.
*
* @param {ArrayArray} entries - input object
* @throws {TypeError} must provide an array of arrays
* @returns {Array} array containing key-value pairs
*
* @example
* var entries = [ ['beep', 'boop'], ['foo', 'bar'] ];
*
* var obj = objectFromEntries( entries );
* // returns {'beep': 'boop', 'foo': 'bar'}
*/
function objectFromEntries( entries ) {
	var out;
	var i;
	if ( !isArrayArray( entries ) ) {
		throw new TypeError( 'invalid input argument. Must provide an array of arrays. Value: `'+entries+'`.' );
	}
	out = {};
	for ( i = 0; i < entries.length; i++ ) {
		out[ entries[i][0] ] = entries[ i ][ 1 ];
	}
	return out;
} // end FUNCTION objectFromEntries()


// EXPORTS //

module.exports = objectFromEntries;

'use strict';

// MODULES //

var isArrayArray = require( '@stdlib/utils/is-array-array' );


// MAIN //

/**
* Creates an object from an array of key-value pairs.
*
* @param {ArrayArray} entries - input object
* @throws {TypeError} must provide an array of arrays
* @returns {Object} object created from `[key, value]` pairs
*
* @example
* var entries = [ ['beep', 'boop'], ['foo', 'bar'] ];
*
* var obj = objectFromEntries( entries );
* // returns {'beep': 'boop', 'foo': 'bar'}
*/
function objectFromEntries( entries ) {
	var out;
	var i;
	if ( !isArrayArray( entries ) ) {
		throw new TypeError( 'invalid input argument. Must provide an array of arrays. Value: `'+entries+'`.' );
	}
	out = {};
	for ( i = 0; i < entries.length; i++ ) {
		out[ entries[i][0] ] = entries[ i ][ 1 ];
	}
	return out;
} // end FUNCTION objectFromEntries()


// EXPORTS //

module.exports = objectFromEntries;

Fix return JSDoc annotation