components/range-slider/js/wNumb.js
function validate ( inputOptions ) {

		var i, optionName, optionValue,
			filteredOptions = {};

		for ( i = 0; i < FormatOptions.length; i+=1 ) {

			optionName = FormatOptions[i];
			optionValue = inputOptions[optionName];

			if ( optionValue === undefined ) {

				// Only default if negativeBefore isn't set.
				if ( optionName === 'negative' && !filteredOptions.negativeBefore ) {
					filteredOptions[optionName] = '-';
				// Don't set a default for mark when 'thousand' is set.
				} else if ( optionName === 'mark' && filteredOptions.thousand !== '.' ) {
					filteredOptions[optionName] = '.';
				} else {
					filteredOptions[optionName] = false;
				}

			// Floating points in JS are stable up to 7 decimals.
			} else if ( optionName === 'decimals' ) {
				if ( optionValue >= 0 && optionValue < 8 ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// These options, when provided, must be functions.
			} else if ( optionName === 'encoder' || optionName === 'decoder' || optionName === 'edit' || optionName === 'undo' ) {
				if ( typeof optionValue === 'function' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// Other options are strings.
			} else {

				if ( typeof optionValue === 'string' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}
			}
		}

		// Some values can't be extracted from a
		// string if certain combinations are present.
		throwEqualError(filteredOptions, 'mark', 'thousand');
		throwEqualError(filteredOptions, 'prefix', 'negative');
		throwEqualError(filteredOptions, 'prefix', 'negativeBefore');

		return filteredOptions;
	}
function validate ( inputOptions ) {

		var i, optionName, optionValue,
			filteredOptions = {};

		for ( i = 0; i < FormatOptions.length; i+=1 ) {

			optionName = FormatOptions[i];
			optionValue = inputOptions[optionName];

			if ( optionValue === undefined ) {

				// Only default if negativeBefore isn't set.
				if ( optionName === 'negative' && !filteredOptions.negativeBefore ) {
					filteredOptions[optionName] = '-';
				// Don't set a default for mark when 'thousand' is set.
				} else if ( optionName === 'mark' && filteredOptions.thousand !== '.' ) {
					filteredOptions[optionName] = '.';
				} else {
					filteredOptions[optionName] = false;
				}

			// Floating points in JS are stable up to 7 decimals.
			} else if ( optionName === 'decimals' ) {
				if ( optionValue >= 0 && optionValue < 8 ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// These options, when provided, must be functions.
			} else if ( optionName === 'encoder' || optionName === 'decoder' || optionName === 'edit' || optionName === 'undo' ) {
				if ( typeof optionValue === 'function' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}

			// Other options are strings.
			} else {

				if ( typeof optionValue === 'string' ) {
					filteredOptions[optionName] = optionValue;
				} else {
					throw new Error(optionName);
				}
			}
		}

		// Some values can't be extracted from a
		// string if certain combinations are present.
		throwEqualError(filteredOptions, 'mark', 'thousand');
		throwEqualError(filteredOptions, 'prefix', 'negative');
		throwEqualError(filteredOptions, 'prefix', 'negativeBefore');

		return filteredOptions;
	}
function validate ( inputOptions ) { var i , optionName , optionValue , filteredOptions = { } ; for ( i = 0 ; i < FormatOptions . length ; i += 1 ) { optionName = FormatOptions [ i ] ; optionValue = inputOptions [ optionName ] ; if ( optionValue === undefined ) { // Only default if negativeBefore isn't set. if ( optionName === 'negative' && ! filteredOptions . negativeBefore ) { filteredOptions [ optionName ] = '-' ; // Don't set a default for mark when 'thousand' is set. } else if ( optionName === 'mark' && filteredOptions . thousand !== '.' ) { filteredOptions [ optionName ] = '.' ; } else { filteredOptions [ optionName ] = false ; } // Floating points in JS are stable up to 7 decimals. } else if ( optionName === 'decimals' ) { if ( optionValue >= 0 && optionValue < 8 ) { filteredOptions [ optionName ] = optionValue ; } else { throw new Error ( optionName ) ; } // These options, when provided, must be functions. } else if ( optionName === 'encoder' || optionName === 'decoder' || optionName === 'edit' || optionName === 'undo' ) { if ( typeof optionValue === 'function' ) { filteredOptions [ optionName ] = optionValue ; } else { throw new Error ( optionName ) ; } // Other options are strings. } else { if ( typeof optionValue === 'string' ) { filteredOptions [ optionName ] = optionValue ; } else { throw new Error ( optionName ) ; } } } // Some values can't be extracted from a // string if certain combinations are present. throwEqualError ( filteredOptions , 'mark' , 'thousand' ) ; throwEqualError ( filteredOptions , 'prefix' , 'negative' ) ; throwEqualError ( filteredOptions , 'prefix' , 'negativeBefore' ) ; return filteredOptions ; }
Framework Validate formatting options
Framework Validate formatting options