Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Good example of bad method naming
validateYears: function(Class, prop) {
var input = Ember.get(Class, prop),
regex = /\D*(\d*)\.?(\d{2}).*/,
result;
if (input.length > 0) {
this.set('errorMsg', null);
if (input.match(regex)) {
result = input.replace(regex, "$1,$2").replace(/[,]/g, '.');
} else {
result = input.replace(/[^,\.0-9]/g, '').replace(/[,]/g, '.');
}
Ember.set(Class, prop, result ? result : '');
} else {
this.set('errorMsg', App.msg.fluidQualities.calendarTimeMustBeGtThanZero);
}
}.observes('years')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.