old_contents: 'use strict';
  
  // MODULES //
  
  var isNonNegativeInteger = require( '@stdlib/utils/is-nonnegative-integer' );
  var isUnityProbabilityArray = require( '@stdlib/utils/is-unity-probability-array' );
  var isBoolean = require( '@stdlib/utils/is-boolean').isPrimitive;
  var isObject = require( '@stdlib/utils/is-plain-object' );
  
  
  // MAIN //
  
  /**
  * Validates function options.
  *
  * @param {Object} opts - destination for validated options
  * @param {Options} options - function options
  * @param {NonNegativeInteger} [options.size] - sample size
  * @param {ProbabilityArray} [options.probs] - element probabilities
  * @param {boolean} [options.replace] - boolean indicating whether to sample with replacement
  * @param {boolean} [options.mutate] - boolean indicating whether to mutate the `pool` when sampling without replacement
  * @returns {(null|Error)} null or an error
  *
  * @example
  * var opts = {};
  * var options = {
  *     'size': 10,
  *     'replace': false,
  *     'mutate': true,
  *     'probs': [ 0.7, 0.3 ]
  * };
  * var err = validate( opts, options );
  * if ( err ) {
  *     throw err;
  * }
  */
  function validate( opts, options ) {
  	if ( !isObject( options ) ) {
  		return new TypeError( 'invalid input argument. Options argument must be an object. Value: `' + options + '`.' );
  	}
  	if ( options.hasOwnProperty( 'size' ) ) {
  		opts.size = options.size;
  		if ( !isNonNegativeInteger( opts.size ) ) {
  			return new TypeError( 'invalid option. `size` option must be a non-negative integer. Option: `' + opts.size + '`.' );
  		}
  	}
  	if ( options.hasOwnProperty( 'probs' ) ) {
  		opts.probs = options.probs;
  		if ( !isUnityProbabilityArray( opts.probs ) ) {
  			return new TypeError( 'invalid option. `probs` option must be an array of probabilities that sum to one. Option: `' + opts.probs + '`.' );
  		}
  	}
  	if ( options.hasOwnProperty( 'mutate' ) ) {
  		opts.mutate = options.mutate;
  		if ( !isBoolean( opts.mutate ) ) {
  			return new TypeError( 'invalid option. `mutate` option must be a boolean primitive. Option: `' + opts.mutate + '`.' );
  		}
  	}
  	if ( options.hasOwnProperty( 'replace' ) ) {
  		opts.replace = options.replace;
  		if ( !isBoolean( opts.replace ) ) {
  			return new TypeError( 'invalid option. `replace` option must be a boolean primitive. Option: `' + opts.replace + '`.' );
  		}
  	}
  	return null;
  } // end FUNCTION validate()
  
  
  // EXPORTS //
  
  module.exports = validate;
  
new_contents: 'use strict';
  
  // MODULES //
  
  var isNonNegativeInteger = require( '@stdlib/utils/is-nonnegative-integer' );
  var isUnityProbabilityArray = require( '@stdlib/utils/is-unity-probability-array' );
  var hasOwnProp = require( '@stdlib/utils/has-own-property' );
  var isBoolean = require( '@stdlib/utils/is-boolean').isPrimitive;
  var isObject = require( '@stdlib/utils/is-plain-object' );
  
  
  // MAIN //
  
  /**
  * Validates function options.
  *
  * @param {Object} opts - destination for validated options
  * @param {Options} options - function options
  * @param {NonNegativeInteger} [options.size] - sample size
  * @param {ProbabilityArray} [options.probs] - element probabilities
  * @param {boolean} [options.replace] - boolean indicating whether to sample with replacement
  * @param {boolean} [options.mutate] - boolean indicating whether to mutate the `pool` when sampling without replacement
  * @returns {(null|Error)} null or an error
  *
  * @example
  * var opts = {};
  * var options = {
  *     'size': 10,
  *     'replace': false,
  *     'mutate': true,
  *     'probs': [ 0.7, 0.3 ]
  * };
  * var err = validate( opts, options );
  * if ( err ) {
  *     throw err;
  * }
  */
  function validate( opts, options ) {
  	if ( !isObject( options ) ) {
  		return new TypeError( 'invalid input argument. Options argument must be an object. Value: `' + options + '`.' );
  	}
  	if ( hasOwnProp( options, 'size' ) ) {
  		opts.size = options.size;
  		if ( !isNonNegativeInteger( opts.size ) ) {
  			return new TypeError( 'invalid option. `size` option must be a non-negative integer. Option: `' + opts.size + '`.' );
  		}
  	}
  	if ( hasOwnProp( options, 'probs' ) ) {
  		opts.probs = options.probs;
  		if ( !isUnityProbabilityArray( opts.probs ) ) {
  			return new TypeError( 'invalid option. `probs` option must be an array of probabilities that sum to one. Option: `' + opts.probs + '`.' );
  		}
  	}
  	if ( hasOwnProp( options, 'mutate' ) ) {
  		opts.mutate = options.mutate;
  		if ( !isBoolean( opts.mutate ) ) {
  			return new TypeError( 'invalid option. `mutate` option must be a boolean primitive. Option: `' + opts.mutate + '`.' );
  		}
  	}
  	if ( hasOwnProp( options, 'replace' ) ) {
  		opts.replace = options.replace;
  		if ( !isBoolean( opts.replace ) ) {
  			return new TypeError( 'invalid option. `replace` option must be a boolean primitive. Option: `' + opts.replace + '`.' );
  		}
  	}
  	return null;
  } // end FUNCTION validate()
  
  
  // EXPORTS //
  
  module.exports = validate;
  
subject: Use hasOwnProp utility