AK-21/Graphite-Industrial-Intelligence
0
1/**2 * @import {Code} from 'micromark-util-types'3 */4 5import { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';6/**7 * Classify whether a code represents whitespace, punctuation, or something8 * else.9 *10 * Used for attention (emphasis, strong), whose sequences can open or close11 * based on the class of surrounding characters.12 *13 * > ๐ **Note**: eof (`null`) is seen as whitespace.14 *15 * @param {Code} code16 * Code.17 * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}18 * Group.19 */20export function classifyCharacter(code) {21 if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {22 return 1;23 }24 if (unicodePunctuation(code)) {25 return 2;26 }27}