mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-03 12:39:29 +08:00
22 lines
527 B
Text
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
|
|
}
|