Socket
Socket
Sign inDemoInstall

stripe-cohort

Package Overview
Dependencies
9
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 0.0.3

3

History.md

@@ -0,1 +1,4 @@

0.0.3 - February 26, 2014
-------------------------
Normalizing subscriptions for MRR

@@ -2,0 +5,0 @@ 0.0.1 - February 26, 2014

@@ -1,2 +0,1 @@

var util = require('util');

@@ -172,3 +171,3 @@

var mrr = this.started(start, end).subscriptions.reduce(function (memo, subscription) {
return memo + amount(subscription);
return memo + amountMrr(subscription);
}, 0.00);

@@ -187,4 +186,5 @@

function amount (subscription) {
function amountMrr (subscription) {
var res = (subscription.plan.amount / 100.0);
res = normalizeMonths(subscription, res);
if (res > 0.0) {

@@ -202,2 +202,20 @@ var discount = subscription.customer.discount;

return res;
}
}
//
function normalizeMonths (subscription, res) {
var interval = subscription.plan.interval;
var count = subscription.plan.interval_count;
if (interval === 'day')
res *= 30 / count;
else if (interval === 'week')
res *= 4 / count;
else if (interval === 'month')
res *= 1 / count;
else if (interval === 'year'){
res = res / 12 / count;
}
else
throw new Error('Unexpected interval ' + interval);
return res;
}

2

package.json
{
"name": "stripe-cohort",
"version": "0.0.2",
"version": "0.0.3",
"main": "./lib",

@@ -5,0 +5,0 @@ "repository": "git://github.com/segmentio/stripe-cohort.git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc