Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parseInstanceData: function( props ) {
// call any base parseInstanceData
if(baseConnect.parseInstanceData) {
// It's possible this might be looking for a property that only exists in some
// responses. So if it doesn't return anything, go back to using props.
props = baseConnect.parseInstanceData.apply(this, arguments) || props;
}
return this.parseInstanceProp ? helpers.getObject(this.parseInstanceProp, props) || props : props;
}
/**
parseListData: function( responseData ) {
// call any base parseListData
if(baseConnect.parseListData) {
responseData = baseConnect.parseListData.apply(this, arguments);
}
var result;
if( isArray(responseData) ) {
result = {data: responseData};
} else {
var prop = this.parseListProp || 'data';
responseData.data = helpers.getObject(prop, responseData);
result = responseData;
if(prop !== "data") {
delete responseData[prop];
}
if(!isArray(result.data)) {
throw new Error('Could not get any raw data while converting using .parseListData');
}
}
var arr = [];
for(var i =0 ; i < result.data.length; i++) {
arr.push( this.parseInstanceData(result.data[i]) );
}
result.data = arr;
return result;
},