mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-05 02:39:30 +08:00
39 lines
902 B
Text
39 lines
902 B
Text
/**
|
|
* @typedef {import('../types.js').Context} Context
|
|
* @typedef {import('../types.js').Options} Options
|
|
*/
|
|
|
|
import {checkBullet} from './check-bullet.js'
|
|
|
|
/**
|
|
* @param {Context} context
|
|
* @returns {Exclude<Options['bullet'], undefined>}
|
|
*/
|
|
export function checkBulletOther(context) {
|
|
const bullet = checkBullet(context)
|
|
const bulletOther = context.options.bulletOther
|
|
|
|
if (!bulletOther) {
|
|
return bullet === '*' ? '-' : '*'
|
|
}
|
|
|
|
if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') {
|
|
throw new Error(
|
|
'Cannot serialize items with `' +
|
|
bulletOther +
|
|
'` for `options.bulletOther`, expected `*`, `+`, or `-`'
|
|
)
|
|
}
|
|
|
|
if (bulletOther === bullet) {
|
|
throw new Error(
|
|
'Expected `bullet` (`' +
|
|
bullet +
|
|
'`) and `bulletOther` (`' +
|
|
bulletOther +
|
|
'`) to be different'
|
|
)
|
|
}
|
|
|
|
return bulletOther
|
|
}
|