'use strict';

/**
* Allocate a buffer using an octet array.
*
* @module @stdlib/buffer/from-array
*
* @example
* var array2buffer = require( '@stdlib/type/buffer/from-array' );
*
* var buf = array2buffer( [ 1, 2, 3, 4 ] );
* // returns <Buffer>
*/

// MODULES //

var hasFrom = require( './has_from.js' );


// MAIN //

var array2buffer;
if ( hasFrom ) {
	array2buffer = require( './main.js' );
} else {
	array2buffer = require( './polyfill.js' );
}


// EXPORTS //

module.exports = array2buffer;

'use strict';

/**
* Allocate a buffer using an octet array.
*
* @module @stdlib/buffer/from-array
*
* @example
* var array2buffer = require( '@stdlib/type/buffer/from-array' );
*
* var buf = array2buffer( [ 1, 2, 3, 4 ] );
* // returns <Buffer>
*/

// MODULES //

var hasFrom = require( './has_from.js' );
var main = require( './main.js' );
var polyfill = require( './polyfill.js' );


// MAIN //

var array2buffer;
if ( hasFrom ) {
	array2buffer = main;
} else {
	array2buffer = polyfill;
}


// EXPORTS //

module.exports = array2buffer;

Refactor to avoid dynamic module resolution
Refactor to avoid dynamic module resolution
