components/range-slider/js/wNumb.js
function formatTo ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {

		var originalInput = input, inputIsNegative, inputPieces, inputBase, inputDecimals = '', output = '';

		// Apply user encoder to the input.
		// Expected outcome: number.
		if ( encoder ) {
			input = encoder(input);
		}

		// Stop if no valid number was provided, the number is infinite or NaN.
		if ( !isValidNumber(input) ) {
			return false;
		}

		// Rounding away decimals might cause a value of -0
		// when using very small ranges. Remove those cases.
		if ( decimals !== false && parseFloat(input.toFixed(decimals)) === 0 ) {
			input = 0;
		}

		// Formatting is done on absolute numbers,
		// decorated by an optional negative symbol.
		if ( input < 0 ) {
			inputIsNegative = true;
			input = Math.abs(input);
		}

		// Reduce the number of decimals to the specified option.
		if ( decimals !== false ) {
			input = toFixed( input, decimals );
		}

		// Transform the number into a string, so it can be split.
		input = input.toString();

		// Break the number on the decimal separator.
		if ( input.indexOf('.') !== -1 ) {
			inputPieces = input.split('.');

			inputBase = inputPieces[0];

			if ( mark ) {
				inputDecimals = mark + inputPieces[1];
			}

		} else {

		// If it isn't split, the entire number will do.
			inputBase = input;
		}

		// Group numbers in sets of three.
		if ( thousand ) {
			inputBase = strReverse(inputBase).match(/.{1,3}/g);
			inputBase = strReverse(inputBase.join( strReverse( thousand ) ));
		}

		// If the number is negative, prefix with negation symbol.
		if ( inputIsNegative && negativeBefore ) {
			output += negativeBefore;
		}

		// Prefix the number
		if ( prefix ) {
			output += prefix;
		}

		// Normal negative option comes after the prefix. Defaults to '-'.
		if ( inputIsNegative && negative ) {
			output += negative;
		}

		// Append the actual number.
		output += inputBase;
		output += inputDecimals;

		// Apply the postfix.
		if ( postfix ) {
			output += postfix;
		}

		// Run the output through a user-specified post-formatter.
		if ( edit ) {
			output = edit ( output, originalInput );
		}

		// All done.
		return output;
	}
function formatTo ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {

		var originalInput = input, inputIsNegative, inputPieces, inputBase, inputDecimals = '', output = '';

		// Apply user encoder to the input.
		// Expected outcome: number.
		if ( encoder ) {
			input = encoder(input);
		}

		// Stop if no valid number was provided, the number is infinite or NaN.
		if ( !isValidNumber(input) ) {
			return false;
		}

		// Rounding away decimals might cause a value of -0
		// when using very small ranges. Remove those cases.
		if ( decimals !== false && parseFloat(input.toFixed(decimals)) === 0 ) {
			input = 0;
		}

		// Formatting is done on absolute numbers,
		// decorated by an optional negative symbol.
		if ( input < 0 ) {
			inputIsNegative = true;
			input = Math.abs(input);
		}

		// Reduce the number of decimals to the specified option.
		if ( decimals !== false ) {
			input = toFixed( input, decimals );
		}

		// Transform the number into a string, so it can be split.
		input = input.toString();

		// Break the number on the decimal separator.
		if ( input.indexOf('.') !== -1 ) {
			inputPieces = input.split('.');

			inputBase = inputPieces[0];

			if ( mark ) {
				inputDecimals = mark + inputPieces[1];
			}

		} else {

		// If it isn't split, the entire number will do.
			inputBase = input;
		}

		// Group numbers in sets of three.
		if ( thousand ) {
			inputBase = strReverse(inputBase).match(/.{1,3}/g);
			inputBase = strReverse(inputBase.join( strReverse( thousand ) ));
		}

		// If the number is negative, prefix with negation symbol.
		if ( inputIsNegative && negativeBefore ) {
			output += negativeBefore;
		}

		// Prefix the number
		if ( prefix ) {
			output += prefix;
		}

		// Normal negative option comes after the prefix. Defaults to '-'.
		if ( inputIsNegative && negative ) {
			output += negative;
		}

		// Append the actual number.
		output += inputBase;
		output += inputDecimals;

		// Apply the postfix.
		if ( postfix ) {
			output += postfix;
		}

		// Run the output through a user-specified post-formatter.
		if ( edit ) {
			output = edit ( output, originalInput );
		}

		// All done.
		return output;
	}
function formatTo ( decimals , thousand , mark , prefix , postfix , encoder , decoder , negativeBefore , negative , edit , undo , input ) { var originalInput = input , inputIsNegative , inputPieces , inputBase , inputDecimals = '' , output = '' ; // Apply user encoder to the input. // Expected outcome: number. if ( encoder ) { input = encoder ( input ) ; } // Stop if no valid number was provided, the number is infinite or NaN. if ( ! isValidNumber ( input ) ) { return false ; } // Rounding away decimals might cause a value of -0 // when using very small ranges. Remove those cases. if ( decimals !== false && parseFloat ( input . toFixed ( decimals ) ) === 0 ) { input = 0 ; } // Formatting is done on absolute numbers, // decorated by an optional negative symbol. if ( input < 0 ) { inputIsNegative = true ; input = Math . abs ( input ) ; } // Reduce the number of decimals to the specified option. if ( decimals !== false ) { input = toFixed ( input , decimals ) ; } // Transform the number into a string, so it can be split. input = input . toString ( ) ; // Break the number on the decimal separator. if ( input . indexOf ( '.' ) !== - 1 ) { inputPieces = input . split ( '.' ) ; inputBase = inputPieces [ 0 ] ; if ( mark ) { inputDecimals = mark + inputPieces [ 1 ] ; } } else { // If it isn't split, the entire number will do. inputBase = input ; } // Group numbers in sets of three. if ( thousand ) { inputBase = strReverse ( inputBase ) . match ( / .{1,3} / g ) ; inputBase = strReverse ( inputBase . join ( strReverse ( thousand ) ) ) ; } // If the number is negative, prefix with negation symbol. if ( inputIsNegative && negativeBefore ) { output += negativeBefore ; } // Prefix the number if ( prefix ) { output += prefix ; } // Normal negative option comes after the prefix. Defaults to '-'. if ( inputIsNegative && negative ) { output += negative ; } // Append the actual number. output += inputBase ; output += inputDecimals ; // Apply the postfix. if ( postfix ) { output += postfix ; } // Run the output through a user-specified post-formatter. if ( edit ) { output = edit ( output , originalInput ) ; } // All done. return output ; }
Formatting Accept a number as input, output formatted string.
Formatting Accept a number as input output formatted string .