How to use the can-connect/helpers/.each 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 canjs / can-connect / src / fixture / fixture.js View on Github external
// Check if the same fixture was previously added, if so, we remove it
		// from our array of fixture overwrites.
		var index = find(settings, !! fixture);
		if (index > -1) {
			overwrites.splice(index, 1);
		}
		if (fixture == null) {
			return;
		}
		settings.fixture = fixture;
		overwrites.push(settings);
		// If a fixture isn't provided, we assume that settings is
		// an array of fixtures, and we should iterate over it, and set up
		// the new fixtures.
	} else {
		helpers.each(settings, function (fixture, url) {
			$fixture(url, fixture);
		});
	}
};
var replacer =  /\{([^\}]+)\}/g;
github bitovi-components / bit-c3 / bit-c3 / node_modules / can-connect / src / data / parse / parse.js View on Github external
* }
		 * ```
		 *
		 * Set `parseInstanceProp` to `"todo"` like:
		 *
		 * ```
		 * can.connect(["data-parse","data-url"],{
		 *   url : "/todos",
		 *   parseInstanceProp: "todo"
		 * });
		 * ```
		 */

	};

	helpers.each(pairs, function(parseFunction, name){
		behavior[name] = function(params){
			var self = this;
			return baseConnect[name].call(this, params).then(function(){
				return self[parseFunction].apply(self, arguments);
			});
		};
	});

	return behavior;

});