How to use the can-connect/helpers/.map 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 / localstorage-cache / localstorage-cache.js View on Github external
*
 * var todoConnection = connect(["data-url","fall-through-cache"],{
 *   url: "/services/todos",
 *   cacheConnection: cacheConnection
 * });
 * ```
 *
 */
var getItems = require("can-connect/helpers/get-items");
var connect = require("can-connect");
var sortedSetJSON = require("can-connect/helpers/sorted-set-json");
var canSet = require("can-set");
require("when/es6-shim/Promise");
var helpers = require("can-connect/helpers/");
var forEach = helpers.forEach;
var map = helpers.map;

//
var indexOf = function(connection, props, items){
	var id = connection.id(props);
	for(var i = 0; i < items.length; i++) {
		if( id == connection.id(items[i]) ) {
			return i;
		}
	}
	return -1;
};

var setAdd = function(set, items, item, algebra){
	return items.concat([item]);
};