Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function fillObject(obj, sample, cohort, bounceCohort) {
if (cohort) {
obj.raw.cohort = Object.assign({}, cohort);
obj.sessions = numeral(cohort.sessions).format("0,0");
obj.pageviews = cohort.pageviews;
obj.medianDuration = parseFloat(cohort.medianDuration["50"]).toFixed(2);
obj.avgPageViews = parseFloat(cohort.avgPageViews).toFixed(2);
obj.duration75 = parseFloat(cohort["percentile.duration"]["75"]).toFixed(2);
obj.duration95 = parseFloat(cohort["percentile.duration"]["95"]).toFixed(2);
obj.duration99 = parseFloat(cohort["percentile.duration"]["99"]).toFixed(2);
}
if (sample) {
obj.raw.sample = Object.assign({}, sample);
obj.totalSessionLength = calcTotalSessionLength(sample.results),
obj.totalSamples = sample.results.length,
obj.bounces = calcBounces(sample.results);
}
if (bounceCohort) {
obj.raw.bounceCohort = Object.assign({}, bounceCohort);
obj.bounces = bounceCohort.steps[0] - bounceCohort.steps[1];
obj.totalSamples = bounceCohort.steps[0];
}
return obj;
}
function fillObject(obj, sample, cohort, bounceCohort) {
if (cohort) {
obj.raw.cohort = Object.assign({}, cohort);
obj.sessions = numeral(cohort.sessions).format("0,0");
obj.pageviews = cohort.pageviews;
obj.medianDuration = parseFloat(cohort.medianDuration["50"]).toFixed(2);
obj.avgPageViews = parseFloat(cohort.avgPageViews).toFixed(2);
obj.duration75 = parseFloat(cohort["percentile.duration"]["75"]).toFixed(2);
obj.duration95 = parseFloat(cohort["percentile.duration"]["95"]).toFixed(2);
obj.duration99 = parseFloat(cohort["percentile.duration"]["99"]).toFixed(2);
}
if (sample) {
obj.raw.sample = Object.assign({}, sample);
obj.totalSessionLength = calcTotalSessionLength(sample.results),
obj.totalSamples = sample.results.length,
obj.bounces = calcBounces(sample.results);
}
if (bounceCohort) {
obj.raw.bounceCohort = Object.assign({}, bounceCohort);
obj.bounces = bounceCohort.steps[0] - bounceCohort.steps[1];
obj.totalSamples = bounceCohort.steps[0];
}
return obj;
}
function fillObject(obj, sample, cohort, bounceCohort) {
if (cohort) {
obj.raw.cohort = Object.assign({}, cohort);
obj.sessions = numeral(cohort.sessions).format("0,0");
obj.pageviews = cohort.pageviews;
obj.medianDuration = parseFloat(cohort.medianDuration["50"]).toFixed(2);
obj.avgPageViews = parseFloat(cohort.avgPageViews).toFixed(2);
obj.duration75 = parseFloat(cohort["percentile.duration"]["75"]).toFixed(2);
obj.duration95 = parseFloat(cohort["percentile.duration"]["95"]).toFixed(2);
obj.duration99 = parseFloat(cohort["percentile.duration"]["99"]).toFixed(2);
}
if (sample) {
obj.raw.sample = Object.assign({}, sample);
obj.totalSessionLength = calcTotalSessionLength(sample.results),
obj.totalSamples = sample.results.length,
obj.bounces = calcBounces(sample.results);
}
if (bounceCohort) {
obj.raw.bounceCohort = Object.assign({}, bounceCohort);
obj.bounces = bounceCohort.steps[0] - bounceCohort.steps[1];
obj.totalSamples = bounceCohort.steps[0];
}
return obj;
}
function percentiles(values) {
return [
percentile(0, values),
percentile(25, values),
percentile(50, values),
percentile(75, values),
percentile(100, values)
];
}
function percentiles(values) {
return [
percentile(0, values),
percentile(25, values),
percentile(50, values),
percentile(75, values),
percentile(100, values)
];
}
function percentiles(values) {
return [
percentile(0, values),
percentile(25, values),
percentile(50, values),
percentile(75, values),
percentile(100, values)
];
}
function percentiles(values) {
return [
percentile(0, values),
percentile(25, values),
percentile(50, values),
percentile(75, values),
percentile(100, values)
];
}
function percentiles(values) {
return [
percentile(0, values),
percentile(25, values),
percentile(50, values),
percentile(75, values),
percentile(100, values)
];
}