Repository URL to install this package:
|
Version:
2.0.0-rc.6 ▾
|
'use strict';
var getAllDoodlePlans = require('./getAllDoodlePlans.js');
/**
* Fetch the available Doodle plans by its plan id number.
* @param {number} id
* @returns {?Object}
*/
function getDoodlePlanById(id) {
if (typeof id !== 'number') {
throw new TypeError(`getDoodlePlanById expects a plan id number. Got ${typeof id}`);
}
const plan = Object.values(getAllDoodlePlans()).filter(p => p.planId === id);
return plan.length ? plan.pop() : null;
}
module.exports = getDoodlePlanById;
//# sourceMappingURL=getDoodlePlanById.js.map