lib/polymorphic.js
function cast(type, variable) {
		var result = variable;

		switch (type) {
			case 'number':
				result = +result;
				break;

			case 'int':
				result = parseInt(result, 10);
				break;

			case 'float':
				result = parseFloat(result);
				break;

			case 'bool':
			case 'boolean':
				result = ['true', '1', 1].indexOf(result) >= 0;
				break;
		}

		return result;
	}
function cast(type, variable) {
		var result = variable;

		switch (type) {
			case 'number':
				result = +result;
				break;

			case 'int':
				result = parseInt(result, 10);
				break;

			case 'float':
				result = parseFloat(result);
				break;

			case 'bool':
			case 'boolean':
				result = ['true', '1', 1].indexOf(result) >= 0;
				break;
		}

		return result;
	}
function cast ( type , variable ) { var result = variable ; switch ( type ) { case 'number' : result = + result ; break ; case 'int' : result = parseInt ( result , 10 ) ; break ; case 'float' : result = parseFloat ( result ) ; break ; case 'bool' : case 'boolean' : result = [ 'true' , '1' , 1 ] . indexOf ( result ) >= 0 ; break ; } return result ; }
Cast variable to given type
@name    cast
@access  internal
@param   string type
@param   string value
@return  mixed  value
Cast variable to given type