semantics_core.js
474 Bytes
// get position of an object from array with given id field value
function indexOfId(array, id) {
var i;
for (i = 0; i < array.length; i++) {
if (array[i].id == id) {
return i;
}
}
return -1;
}
function normalizeFormData(data) {
if ((typeof data) == 'string') {
return [data];
} else {
if ((typeof data) == 'undefined') {
return [];
} else {
return data;
}
}
}