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

		var originalInput = input, inputIsNegative, output = '';

		// User defined pre-decoder. Result must be a non empty string.
		if ( undo ) {
			input = undo(input);
		}

		// Test the input. Can't be empty.
		if ( !input || typeof input !== 'string' ) {
			return false;
		}

		// If the string starts with the negativeBefore value: remove it.
		// Remember is was there, the number is negative.
		if ( negativeBefore && strStartsWith(input, negativeBefore) ) {
			input = input.replace(negativeBefore, '');
			inputIsNegative = true;
		}

		// Repeat the same procedure for the prefix.
		if ( prefix && strStartsWith(input, prefix) ) {
			input = input.replace(prefix, '');
		}

		// And again for negative.
		if ( negative && strStartsWith(input, negative) ) {
			input = input.replace(negative, '');
			inputIsNegative = true;
		}

		// Remove the postfix.
		// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
		if ( postfix && strEndsWith(input, postfix) ) {
			input = input.slice(0, -1 * postfix.length);
		}

		// Remove the thousand grouping.
		if ( thousand ) {
			input = input.split(thousand).join('');
		}

		// Set the decimal separator back to period.
		if ( mark ) {
			input = input.replace(mark, '.');
		}

		// Prepend the negative symbol.
		if ( inputIsNegative ) {
			output += '-';
		}

		// Add the number
		output += input;

		// Trim all non-numeric characters (allow '.' and '-');
		output = output.replace(/[^0-9\.\-.]/g, '');

		// The value contains no parse-able number.
		if ( output === '' ) {
			return false;
		}

		// Covert to number.
		output = Number(output);

		// Run the user-specified post-decoder.
		if ( decoder ) {
			output = decoder(output);
		}

		// Check is the output is valid, otherwise: return false.
		if ( !isValidNumber(output) ) {
			return false;
		}

		return output;
	}
function formatFrom ( decimals, thousand, mark, prefix, postfix, encoder, decoder, negativeBefore, negative, edit, undo, input ) {

		var originalInput = input, inputIsNegative, output = '';

		// User defined pre-decoder. Result must be a non empty string.
		if ( undo ) {
			input = undo(input);
		}

		// Test the input. Can't be empty.
		if ( !input || typeof input !== 'string' ) {
			return false;
		}

		// If the string starts with the negativeBefore value: remove it.
		// Remember is was there, the number is negative.
		if ( negativeBefore && strStartsWith(input, negativeBefore) ) {
			input = input.replace(negativeBefore, '');
			inputIsNegative = true;
		}

		// Repeat the same procedure for the prefix.
		if ( prefix && strStartsWith(input, prefix) ) {
			input = input.replace(prefix, '');
		}

		// And again for negative.
		if ( negative && strStartsWith(input, negative) ) {
			input = input.replace(negative, '');
			inputIsNegative = true;
		}

		// Remove the postfix.
		// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
		if ( postfix && strEndsWith(input, postfix) ) {
			input = input.slice(0, -1 * postfix.length);
		}

		// Remove the thousand grouping.
		if ( thousand ) {
			input = input.split(thousand).join('');
		}

		// Set the decimal separator back to period.
		if ( mark ) {
			input = input.replace(mark, '.');
		}

		// Prepend the negative symbol.
		if ( inputIsNegative ) {
			output += '-';
		}

		// Add the number
		output += input;

		// Trim all non-numeric characters (allow '.' and '-');
		output = output.replace(/[^0-9\.\-.]/g, '');

		// The value contains no parse-able number.
		if ( output === '' ) {
			return false;
		}

		// Covert to number.
		output = Number(output);

		// Run the user-specified post-decoder.
		if ( decoder ) {
			output = decoder(output);
		}

		// Check is the output is valid, otherwise: return false.
		if ( !isValidNumber(output) ) {
			return false;
		}

		return output;
	}
function formatFrom ( decimals , thousand , mark , prefix , postfix , encoder , decoder , negativeBefore , negative , edit , undo , input ) { var originalInput = input , inputIsNegative , output = '' ; // User defined pre-decoder. Result must be a non empty string. if ( undo ) { input = undo ( input ) ; } // Test the input. Can't be empty. if ( ! input || typeof input !== 'string' ) { return false ; } // If the string starts with the negativeBefore value: remove it. // Remember is was there, the number is negative. if ( negativeBefore && strStartsWith ( input , negativeBefore ) ) { input = input . replace ( negativeBefore , '' ) ; inputIsNegative = true ; } // Repeat the same procedure for the prefix. if ( prefix && strStartsWith ( input , prefix ) ) { input = input . replace ( prefix , '' ) ; } // And again for negative. if ( negative && strStartsWith ( input , negative ) ) { input = input . replace ( negative , '' ) ; inputIsNegative = true ; } // Remove the postfix. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice if ( postfix && strEndsWith ( input , postfix ) ) { input = input . slice ( 0 , - 1 * postfix . length ) ; } // Remove the thousand grouping. if ( thousand ) { input = input . split ( thousand ) . join ( '' ) ; } // Set the decimal separator back to period. if ( mark ) { input = input . replace ( mark , '.' ) ; } // Prepend the negative symbol. if ( inputIsNegative ) { output += '-' ; } // Add the number output += input ; // Trim all non-numeric characters (allow '.' and '-'); output = output . replace ( / [^0-9\.\-.] / g , '' ) ; // The value contains no parse-able number. if ( output === '' ) { return false ; } // Covert to number. output = Number ( output ) ; // Run the user-specified post-decoder. if ( decoder ) { output = decoder ( output ) ; } // Check is the output is valid, otherwise: return false. if ( ! isValidNumber ( output ) ) { return false ; } return output ; }
Accept a sting as input, output decoded number.
Accept a sting as input output decoded number .