lib/sampler/sampler.js
function transformer(data, id) {
	function checkValue(obj) {
		if (!obj || typeof obj !== 'object') {
			return;
		}

		var keys = Object.keys(obj);

		if (keys.indexOf('value') !== -1) {
			obj.values = {};
			obj.values[id] = obj.value;
			delete obj.value;
			return;
		}

		for (var i = 0; i < keys.length; i++) {
			checkValue(obj[keys[i]]);
		}
	}

	checkValue(data);

	return data;
}
function transformer(data, id) {
	function checkValue(obj) {
		if (!obj || typeof obj !== 'object') {
			return;
		}

		var keys = Object.keys(obj);

		if (keys.indexOf('value') !== -1) {
			obj.values = {};
			obj.values[id] = obj.value;
			delete obj.value;
			return;
		}

		for (var i = 0; i < keys.length; i++) {
			checkValue(obj[keys[i]]);
		}
	}

	checkValue(data);

	return data;
}
function transformer ( data , id ) { function checkValue ( obj ) { if ( ! obj || typeof obj !== 'object' ) { return ; } var keys = Object . keys ( obj ) ; if ( keys . indexOf ( 'value' ) !== - 1 ) { obj . values = { } ; obj . values [ id ] = obj . value ; delete obj . value ; return ; } for ( var i = 0 ; i < keys . length ; i ++ ) { checkValue ( obj [ keys [ i ] ] ) ; } } checkValue ( data ) ; return data ; }
A custom panopticon transformer function. This mutates datasets into a format that is more useful
to observium.

@param  {Object} data A panopticon data aggregate.
@param  {string} id   The ID of a cluster member.
@return {Object}      Mutated data.
A custom panopticon transformer function . This mutates datasets into a format that is more useful to observium .