'use strict';

// MODULES //

var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;


// MAIN //

/**
* Validates function options.
*
* @private
* @param {Object} opts - destination object
* @param {Options} options - function options
* @param {string} [options.cwd] - current working directory of the child process
* @param {boolean} [options.quiet] - boolean indicating whether to silence examples writing to `stdout`, but allow writing to `stderr`
* @param {boolean} [options.silent] - boolean indicating whether to silence examples writing to both `stdout` and `stderr`
* @param {boolean} [options.verbose] - boolean indicating whether to print plugin meta information
* @returns {(Error|null)} null or an error object
*
* @example
* var opts = {};
* var options = {
*     'quiet': true,
*     'verbose': false
* };
* var err = validate( opts, options );
* if ( err ) {
*     throw err;
* }
*/
function validate( opts, options ) {
	if ( !isObject( options ) ) {
		return new TypeError( 'invalid input argument. Options must be an object. Value: `' + options + '`.' );
	}
	if ( hasOwnProp( options, 'cwd' ) ) {
		if ( !isString( options.cwd ) ) {
			return new TypeError( 'invalid option. `cwd` option must be a string primitive. Option: `' + options.cwd + '`.' );
		}
		opts.cwd = options.cwd;
	}
	if ( hasOwnProp( options, 'quiet' ) ) {
		if ( !isBoolean( options.quiet ) ) {
			return new TypeError( 'invalid option. `quiet` option must be a boolean primitive. Option: `' + options.quiet + '`.' );
		}
		opts.quiet = options.quiet;
	}
	if ( hasOwnProp( options, 'silent' ) ) {
		if ( !isBoolean( options.silent ) ) {
			return new TypeError( 'invalid option. `silent` option must be a boolean primitive. Option: `' + options.silent + '`.' );
		}
		opts.silent = options.silent;
	}
	if ( hasOwnProp( options, 'verbose' ) ) {
		if ( !isBoolean( options.verbose ) ) {
			return new TypeError( 'invalid option. `verbose` option must be a boolean primitive. Option: `' + options.verbose + '`.' );
		}
		opts.verbose = options.verbose;
	}
	if ( hasOwnProp( options, 'maxBuffer' ) ) {
		if ( !isPositiveInteger( options.maxBuffer ) ) {
			return new TypeError( 'invalid option. `maxBuffer` option must be a positive integer. Option: `' + options.maxBuffer + '`.' );
		}
		opts.maxBuffer = options.maxBuffer;
	}
	return null;
} // end FUNCTION validate()


// EXPORTS //

module.exports = validate;

@@ -954,16 +954,111 @@
 rmation%0A
+* @param %7BPositiveInteger%7D %5Boptions.maxBuffer%5D - maximum buffer size for %60stdout%60 and %60stderr%60%0A
 * @retur

Add missing parameter