src/ResourceView.js
function ResourceView(opts) {
	var view = this;

	var compute_keys;
	if(opts && opts.compute_keys) {
		compute_keys = opts.compute_keys;
	}

	var element_keys;
	if(opts && opts.element_keys) {
		element_keys = opts.element_keys;
	}

	var collection_keys;
	if(opts && opts.collection_keys) {
		collection_keys = opts.collection_keys;
	}

	var element_post;
	if(opts && opts.element_post) {
		element_post = opts.element_post;
	}

	var collection_post;
	if(opts && opts.collection_post) {
		collection_post = opts.collection_post;
	}

	opts = copy(opts || {});

	debug.assert(opts).is('object');
	debug.assert(opts.path).is('string');

	view.opts = {};
	view.opts.keys = opts.keys || ['$id', '$type', '$ref'];
	view.opts.path = opts.path;
	view.opts.elementPath = opts.elementPath;

	view.Type = opts.Type;

	if(is.obj(compute_keys)) {
		view.compute_keys = compute_keys;
	}

	if(is.obj(element_keys)) {
		view.element_keys = element_keys;
	}

	if(is.obj(collection_keys)) {
		view.collection_keys = collection_keys;
	}

	if(is.func(element_post)) {
		view.element_post = element_post;
	}

	if(is.func(collection_post)) {
		view.collection_post = collection_post;
	}

	//debug.log("view.opts = ", view.opts);
}
function ResourceView(opts) {
	var view = this;

	var compute_keys;
	if(opts && opts.compute_keys) {
		compute_keys = opts.compute_keys;
	}

	var element_keys;
	if(opts && opts.element_keys) {
		element_keys = opts.element_keys;
	}

	var collection_keys;
	if(opts && opts.collection_keys) {
		collection_keys = opts.collection_keys;
	}

	var element_post;
	if(opts && opts.element_post) {
		element_post = opts.element_post;
	}

	var collection_post;
	if(opts && opts.collection_post) {
		collection_post = opts.collection_post;
	}

	opts = copy(opts || {});

	debug.assert(opts).is('object');
	debug.assert(opts.path).is('string');

	view.opts = {};
	view.opts.keys = opts.keys || ['$id', '$type', '$ref'];
	view.opts.path = opts.path;
	view.opts.elementPath = opts.elementPath;

	view.Type = opts.Type;

	if(is.obj(compute_keys)) {
		view.compute_keys = compute_keys;
	}

	if(is.obj(element_keys)) {
		view.element_keys = element_keys;
	}

	if(is.obj(collection_keys)) {
		view.collection_keys = collection_keys;
	}

	if(is.func(element_post)) {
		view.element_post = element_post;
	}

	if(is.func(collection_post)) {
		view.collection_post = collection_post;
	}

	//debug.log("view.opts = ", view.opts);
}
function ResourceView ( opts ) { var view = this ; var compute_keys ; if ( opts && opts . compute_keys ) { compute_keys = opts . compute_keys ; } var element_keys ; if ( opts && opts . element_keys ) { element_keys = opts . element_keys ; } var collection_keys ; if ( opts && opts . collection_keys ) { collection_keys = opts . collection_keys ; } var element_post ; if ( opts && opts . element_post ) { element_post = opts . element_post ; } var collection_post ; if ( opts && opts . collection_post ) { collection_post = opts . collection_post ; } opts = copy ( opts || { } ) ; debug . assert ( opts ) . is ( 'object' ) ; debug . assert ( opts . path ) . is ( 'string' ) ; view . opts = { } ; view . opts . keys = opts . keys || [ '$id' , '$type' , '$ref' ] ; view . opts . path = opts . path ; view . opts . elementPath = opts . elementPath ; view . Type = opts . Type ; if ( is . obj ( compute_keys ) ) { view . compute_keys = compute_keys ; } if ( is . obj ( element_keys ) ) { view . element_keys = element_keys ; } if ( is . obj ( collection_keys ) ) { view . collection_keys = collection_keys ; } if ( is . func ( element_post ) ) { view . element_post = element_post ; } if ( is . func ( collection_post ) ) { view . collection_post = collection_post ; } //debug.log("view.opts = ", view.opts); }
Builds a builder for REST data views
Builds a builder for REST data views