Urara-Blog/node_modules/.pnpm-store/v3/files/6e/fb0a9dcfafaac38ad28b8d82e3f5c5d4f7f4075ae54997b7f64b075a6e5dc5d463a2591df38b6c5f484f597d78e733d7ae1d3c12eb8bca5c7fd33d662e8966
2022-08-14 01:14:53 +08:00

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
}