pargras.js
/**
	 * Pargras is a minimalistic helper around function arguments for Node.js and the browser.
	 * Pargras has a fluent interface and supports adding, removing and altering arguments
	 * before applying them to a function.
	 *
	 * @param args Function arguments object.
	 * @constructor
	 * @example
	 * // Instantiate the arguments helper.
	 * const args = new Pargras(arguments);
	 *
	 * // Remove first and last parameter, then call Math.min() with the resulting arguments.
	 * var min = args.shift().pop().applyTo(Math.min);
	 *
	 * // More examples to be be found in the unit tests.
	 */
Pargras is a minimalistic helper around function arguments for Node.js and the browser.
Pargras has a fluent interface and supports adding, removing and altering arguments
before applying them to a function.

@param args Function arguments object.
@constructor
@example
Instantiate the arguments helper.
const args = new Pargras(arguments).

Remove first and last parameter, then call Math.min() with the resulting arguments.

More examples to be be found in the unit tests.
Pargras is a minimalistic helper around function arguments for Node . js and the browser . Pargras has a fluent interface and supports adding removing and altering arguments before applying them to a function . @param args Function arguments object . @constructor @example Instantiate the arguments helper . const args = new Pargras ( arguments ) . Remove first and last parameter then call Math . min () with the resulting arguments . More examples to be be found in the unit tests .
function Pargras(args)
	{
		'use strict';
		var argsArray,
			i,
			l;
		if (!isArguments(args))
		{
			throw new Error("Parameter is no arguments object");
		}
		argsArray = new Array(args.length);
		for (i = 0, l = argsArray.length; i < l; i++)
		{
			argsArray[i] = args[i];
		}
		this.array = function()
		{
			return argsArray;
		};
		this.length = function()
		{
			return argsArray.length;
		};
		this.set = function(n, value)
		{
			if (n < argsArray.length)
			{
				argsArray[n] = value;
			}
			return this;
		};
		this.get = function(n)
		{
			return argsArray[n];
		};
		this.shift = function()
		{
			argsArray.shift();
			return this;
		};
		this.pop = function()
		{
			argsArray.pop();
			return this;
		};
		this.unshift = function()
		{
			var i;
			for (i = arguments.length - 1; i >= 0; i--)
			{
				argsArray.unshift(arguments[i]);
			}
			return this;
		};
		this.push = function()
		{
			var i,
				l = arguments.length;
			for (i = 0; i < l; i++)
			{
				argsArray.push(arguments[i]);
			}
			return this;
		};
		this.applyTo = function(func, thisArg)
		{
			return func.apply(thisArg || null, argsArray);
		};
		function isArguments(value)
		{
			return value != null && typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, 'callee');
		}
	}
function Pargras ( args ) { 'use strict' ; var argsArray , i , l ; if ( ! isArguments ( args ) ) { throw new Error ( "Parameter is no arguments object" ) ; } argsArray = new Array ( args . length ) ; for ( i = 0 , l = argsArray . length ; i < l ; i ++ ) { argsArray [ i ] = args [ i ] ; } this . array = function ( ) { return argsArray ; } ; this . length = function ( ) { return argsArray . length ; } ; this . set = function ( n , value ) { if ( n < argsArray . length ) { argsArray [ n ] = value ; } return this ; } ; this . get = function ( n ) { return argsArray [ n ] ; } ; this . shift = function ( ) { argsArray . shift ( ) ; return this ; } ; this . pop = function ( ) { argsArray . pop ( ) ; return this ; } ; this . unshift = function ( ) { var i ; for ( i = arguments . length - 1 ; i >= 0 ; i -- ) { argsArray . unshift ( arguments [ i ] ) ; } return this ; } ; this . push = function ( ) { var i , l = arguments . length ; for ( i = 0 ; i < l ; i ++ ) { argsArray . push ( arguments [ i ] ) ; } return this ; } ; this . applyTo = function ( func , thisArg ) { return func . apply ( thisArg || null , argsArray ) ; } ; function isArguments ( value ) { return value != null && typeof value === 'object' && Object . prototype . hasOwnProperty . call ( value , 'callee' ) ; } }
Pargras is a minimalistic helper around function arguments for Node.js and the browser.
Pargras is a minimalistic helper around function arguments for Node . js and the browser .
// Test for valid constructor parameter. // Convert arguments to array. /**
		 * Return constructor arguments as an array.
		 *
		 * @returns {any[]}
		 */ /**
		 * Return the number of arguments passed to the constructor.
		 *
		 * @returns {Number}
		 */ /**
		 * Change the value of the nth argument passed to constructor.
		 *
		 * @param n Index of argument to be altered.
		 * @param value New value to be set.
		 * @returns {Pargras}
		 */ /**
		 * Return the value of the nth argument passed to constructor.
		 *
		 * @param n Index of argument to be returned.
		 * @returns {any}
		 */ /**
		 * Remove first argument passed to constructor.
		 *
		 * @returns {Pargras}
		 */ /**
		 * Remove last argument passed to constructor.
		 *
		 * @returns {Pargras}
		 */ /**
		 * Add one or more elements to the beginning of the constructor arguments.
		 *
		 * @returns {Pargras}
		 */ /* element1[, ...[, elementN]] */ /**
		 * Add one or more elements to the end of the constructor arguments.
		 *
		 * @returns {Pargras}
		 */ /* element1[, ...[, elementN]] */ /**
		 * Apply arguments and an optional 'this' argument to the given function.
		 *
		 * @param func Function to be called.
		 * @param thisArg Optional this argument.
		 * @returns {*} Returns the called functions return value.
		 */