overleaf/services/web/app/src/Features/Subscription/PlansLocator.js
Miguel Serrano f9871103bf Merge pull request #3949 from overleaf/msm-reenable-eslint-const-rule
Reenable eslint `prefer-const` rule

GitOrigin-RevId: 4f3825be8b8dff381095209085a36eaab76260d5
2021-05-06 02:09:14 +00:00

25 lines
549 B
JavaScript

const Settings = require('settings-sharelatex')
const logger = require('logger-sharelatex')
function ensurePlansAreSetupCorrectly() {
Settings.plans.forEach(plan => {
if (typeof plan.price !== 'number') {
logger.fatal({ plan }, 'missing price on plan')
process.exit(1)
}
})
}
function findLocalPlanInSettings(planCode) {
for (const plan of Settings.plans) {
if (plan.planCode === planCode) {
return plan
}
}
return null
}
module.exports = {
ensurePlansAreSetupCorrectly,
findLocalPlanInSettings,
}