How to use the can-connect/helpers/.isArray function in can-connect

To help you get started, we’ve selected a few can-connect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitovi-components / bit-c3 / bit-c3 / node_modules / can-connect / src / data / parse / parse.js View on Github external
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++) {
github bitovi-components / bit-c3 / bit-c3 / node_modules / can-connect / src / helpers / get-items.js View on Github external
module.exports = function(data){
	if(isArray(data)) {
		return data;
	} else {
		return data.data;
	}
};
github bitovi-components / bit-c3 / bit-c3 / node_modules / can-connect / src / data / parse / parse.js View on Github external
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;
		},
		/**