datatype-number-debug.js revision 761e9178cfaf5a97357730120fe13b8171aeb2eb
/**
* Parse number submodule.
*
* @module datatype
* @submodule datatype-number-parse
* @for DataType.Number
*/
/**
* Converts data to type Number.
*
* @method parse
* @param data {String | Number | Boolean} Data to convert. The following
* values return as null: null, undefined, NaN, "".
* @return {Number} A number, or null.
*/
return number;
}
else {
return null;
}
}
});
// Add Parsers shortcut
/**
* Number submodule.
*
* @module datatype
* @submodule datatype-number
*/
/**
* Format number submodule.
*
* @module datatype
* @submodule datatype-number-format
*/
/**
* DataType.Number provides a set of utility functions to operate against Number objects.
*
* @class DataType.Number
* @static
*/
/**
* Takes a Number and formats to string for display to user.
*
* @method format
* @param data {Number} Number.
* @param config {Object} (Optional) Optional configuration values:
* <dl>
* <dt>prefix {String}</dd>
* <dd>String prepended before each number, like a currency designator "$"</dd>
* <dt>decimalPlaces {Number}</dd>
* <dd>Number of decimal places to round. Must be a number 0 to 20.</dd>
* <dt>decimalSeparator {String}</dd>
* <dd>Decimal separator</dd>
* <dt>thousandsSeparator {String}</dd>
* <dd>Thousands separator</dd>
* <dt>suffix {String}</dd>
* <dd>String appended after each number, like " items" (note the space)</dd>
* </dl>
* @return {String} Formatted number for display. Note, the following values
* return as "": null, undefined, NaN, "".
*/
// Decimal precision
// Round to the correct decimal place
}
// Decimal separator
if(decSep !== "."){
}
// Add the thousands separator
if(thouSep) {
// Find the dot or where it would be
// Start with the dot and everything to the right
// Working left, every third time add a separator, every time add a digit
}
count++;
}
}
// Prepend prefix
// Append suffix
return output;
}
// Not a Number, just return as string
else {
}
}
});
YUI.add('datatype-number', function(Y){}, '@VERSION@' ,{use:['datatype-number-parse', 'datatype-number-format']});