Urara-Blog/node_modules/.pnpm-store/v3/files/70/e2fa700d19e0df57b0e811ae3541e69c3d6b8cff13125899aa3e2f3a4713f424b1d914e4130b7714de51c7d0b0651a98d70e6fabda7f842a85c2d400424da4
2022-08-14 01:14:53 +08:00

22 lines
527 B
Text

/**
* @typedef {import('../types.js').Context} Context
* @typedef {import('../types.js').Options} Options
*/
/**
* @param {Context} context
* @returns {Exclude<Options['ruleRepetition'], undefined>}
*/
export function checkRuleRepetition(context) {
const repetition = context.options.ruleRepetition || 3
if (repetition < 3) {
throw new Error(
'Cannot serialize rules with repetition `' +
repetition +
'` for `options.ruleRepetition`, expected `3` or more'
)
}
return repetition
}