lib/cli.js
function filterArguments(args, params, inject) {

	var newArgs = ['node', '_mocha'].concat(inject || []),
		param, i, len,
		type;

	for (i = 2, len = args.length; i < len; i++) {

		if ((i < args.length - 1) && (args[i].length > 2) && (args[i].substr(0, 2) === '--')) {

			// Get parameter without '--'
			param = args[i].substr(2);

			// Is parameter used?
			if (params.hasOwnProperty(param)) {

				// Remember what the type was
				type = typeof params[param];

				// Overwrite value with next value in arguments
				if (type === 'boolean') {
					params[param] = true;

				} else {
					params[param] = args[i + 1];
					i++;

					// Convert back to boolean if needed
					if (type === 'number') {
						params[param] = parseFloat(params[param]);
					}
				}

			} else {
				newArgs.push(args[i]);
			}
		} else {
			newArgs.push(args[i]);
		}
	}

	// Set test-path with last argument if none given
	if (!params['test-path']) {
		params['test-path'] = args.pop();
	}

	newArgs.push(path.join(__dirname, '..', 'resource', 'run.js'));

	return newArgs;
}
function filterArguments(args, params, inject) {

	var newArgs = ['node', '_mocha'].concat(inject || []),
		param, i, len,
		type;

	for (i = 2, len = args.length; i < len; i++) {

		if ((i < args.length - 1) && (args[i].length > 2) && (args[i].substr(0, 2) === '--')) {

			// Get parameter without '--'
			param = args[i].substr(2);

			// Is parameter used?
			if (params.hasOwnProperty(param)) {

				// Remember what the type was
				type = typeof params[param];

				// Overwrite value with next value in arguments
				if (type === 'boolean') {
					params[param] = true;

				} else {
					params[param] = args[i + 1];
					i++;

					// Convert back to boolean if needed
					if (type === 'number') {
						params[param] = parseFloat(params[param]);
					}
				}

			} else {
				newArgs.push(args[i]);
			}
		} else {
			newArgs.push(args[i]);
		}
	}

	// Set test-path with last argument if none given
	if (!params['test-path']) {
		params['test-path'] = args.pop();
	}

	newArgs.push(path.join(__dirname, '..', 'resource', 'run.js'));

	return newArgs;
}
function filterArguments ( args , params , inject ) { var newArgs = [ 'node' , '_mocha' ] . concat ( inject || [ ] ) , param , i , len , type ; for ( i = 2 , len = args . length ; i < len ; i ++ ) { if ( ( i < args . length - 1 ) && ( args [ i ] . length > 2 ) && ( args [ i ] . substr ( 0 , 2 ) === '--' ) ) { // Get parameter without '--' param = args [ i ] . substr ( 2 ) ; // Is parameter used? if ( params . hasOwnProperty ( param ) ) { // Remember what the type was type = typeof params [ param ] ; // Overwrite value with next value in arguments if ( type === 'boolean' ) { params [ param ] = true ; } else { params [ param ] = args [ i + 1 ] ; i ++ ; // Convert back to boolean if needed if ( type === 'number' ) { params [ param ] = parseFloat ( params [ param ] ) ; } } } else { newArgs . push ( args [ i ] ) ; } } else { newArgs . push ( args [ i ] ) ; } } // Set test-path with last argument if none given if ( ! params [ 'test-path' ] ) { params [ 'test-path' ] = args . pop ( ) ; } newArgs . push ( path . join ( __dirname , '..' , 'resource' , 'run.js' ) ) ; return newArgs ; }
Filters arguments given and sets them to parameters

@method filterArguments
@param {string[]} args
@param {object} params
@param {string[]} [inject]
@return {string[]}
@private
Filters arguments given and sets them to parameters