'use strict';

// MODULES //

var debug = require( 'debug' )( 'plot:set:x-rug-opacity' );
var isNumber = require( '@stdlib/utils/is-number' ).isPrimitive;
var isNumberArray = require( '@stdlib/utils/is-number' ).isPrimitiveNumberArray;


// MAIN //

/**
* Sets the x-axis rug opacity.
*
* @private
* @param {(number|NumberArray)} v - opacity
* @throws {TypeError} must be a number or number array
* @throws {RangeError} must be a number on the interval `[0,1]`
*/
function set( v ) {
	/*jshint validthis: true */ // TODO: eslint
	var isNum = isNumber( v );
	var i;
	if (
		!isNum &&
		!isNumberArray( v )
	) {
		throw new TypeError( 'invalid value. `xRugOpacity` must be a number or number array. Value: `' + v + '.`' );
	}
	if ( isNum ) {
		v = [ v ];
	} else {
		v = v.slice();
	}
	for ( i = 0; i < v.length; i++ ) {
		if (
			v[ i ] < 0.0 ||
			v[ i ] > 1.0
		) {
			throw new RangeError( 'invalid value. An `xRugOpacity` must be a number on the interval `[0,1]`. Value: `' + v[i] + '`.' );
		}
	}
	debug( 'Current value: %d.', this._xRugOpacity );

	this._xRugOpacity = v;
	debug( 'New Value: %d.', this._xRugOpacity );

	this.emit( 'change' );
} // end FUNCTION set()


// EXPORTS //

module.exports = set;

'use strict';

// MODULES //

var debug = require( 'debug' )( 'plot:set:x-rug-opacity' );
var isNumber = require( '@stdlib/utils/is-number' ).isPrimitive;
var isNumberArray = require( '@stdlib/utils/is-number-array' ).primitives;


// MAIN //

/**
* Sets the x-axis rug opacity.
*
* @private
* @param {(number|NumberArray)} v - opacity
* @throws {TypeError} must be a number or number array
* @throws {RangeError} must be a number on the interval `[0,1]`
*/
function set( v ) {
	/*jshint validthis: true */ // TODO: eslint
	var isNum = isNumber( v );
	var i;
	if (
		!isNum &&
		!isNumberArray( v )
	) {
		throw new TypeError( 'invalid value. `xRugOpacity` must be a number or number array. Value: `' + v + '.`' );
	}
	if ( isNum ) {
		v = [ v ];
	} else {
		v = v.slice();
	}
	for ( i = 0; i < v.length; i++ ) {
		if (
			v[ i ] < 0.0 ||
			v[ i ] > 1.0
		) {
			throw new RangeError( 'invalid value. An `xRugOpacity` must be a number on the interval `[0,1]`. Value: `' + v[i] + '`.' );
		}
	}
	debug( 'Current value: %d.', this._xRugOpacity );

	this._xRugOpacity = v;
	debug( 'New Value: %d.', this._xRugOpacity );

	this.emit( 'change' );
} // end FUNCTION set()


// EXPORTS //

module.exports = set;

Fix require path