Skip to content
Snippets Groups Projects
Commit a8fe19a5 authored by deuce's avatar deuce
Browse files

Be more aggressive in trying to wring a valid attribute out of the constructor

parameter.
parent 8335cd40
No related branches found
No related tags found
No related merge requests found
function Attribute(value) {
if (value === undefined)
this.value = 7;
else if (typeof(value) == 'object' && value.value !== undefined && typeof(value.value) == 'number')
this.value = value.value;
else
else if (typeof(value) == 'object' && value.value !== undefined) {
if (typeof(value.value) == 'number')
this.value = value.value;
else {
try {
this.value=parseInt(value, 10);
}
catch(e) {
this.value = 7;
}
}
}
else if (typeof(value) == 'number')
this.value = value;
else {
try {
this.value=parseInt(value, 10);
}
catch(e) {
this.value = 7;
}
}
}
Attribute.BLACK = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment