/** * A class responsible for formatting and unformatting numbers. */ define( [ 'dojo/_base/declare', 'dojo/number' ], function(declare, number) { return declare( null, { constructor : function(info) { this.info = info; }, format : function(value) { if (value == undefined || value == null || ((typeof value != "string") && (typeof value != "number")) || (typeof value == "string") && value.trim() === '') { return ''; } return number .format(value, this.info.configuration); }, unformat : function(value) { if (value == undefined || value == null || ((typeof value != "string") && (typeof value != "number")) || (typeof value == "string") && value.trim() === '') { return null; } if (typeof value == "number") { return value; } return number.parse(value, this.info.configuration); } }); });