How to use the jsprim.flattenIter function in jsprim

To help you get started, we’ve selected a few jsprim 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 joyent / node-skinner / lib / skinner.js View on Github external
skAggregator.prototype._flush = function (callback)
{
	if (!this.sa_aspoints) {
		this.push(this.result());
		callback();
		return;
	}

	var self, bucketizer;

	self = this;
	mod_jsprim.flattenIter(this.sa_value, this.sa_decomps.length,
	    function (row) {
		var point, i, val, field;

		point = {
		    'fields': {},
		    'value': 0
		};

		for (i = 0; i < self.sa_decomps.length; i++) {
			field = self.sa_decomps[i];

			if (self.sa_bucketizers.hasOwnProperty(field)) {
				bucketizer = self.sa_bucketizers[field];

				/*
				 * The "+" conversion is necessary because the