Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/billing-client / dist / index.cjs.js / getDoodlePlanById.js
Size: Mime:
'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