Repository URL to install this package:
|
Version:
2.0.1 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = convertSubscription;
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**
* Converts the subscription object returned by the OAB endpoints, so that
* it can be easily used on the frontend.
* At the moment, it just converts the dates from ISO format into Date objects.
* @param {object} subscription The subscription object retrieved from the endpoint
* @returns {Object} The converted subscription object
*/
function convertSubscription(subscription) {
return _objectSpread({}, subscription, {
start: new Date(subscription.start),
lastPaymentDate: new Date(subscription.lastPaymentDate)
});
}