mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 08:45:23 +00:00

Greatly simplify how ESLint and its plugins are installed. PR-URL: https://github.com/nodejs/node/pull/53413 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
28 lines
880 B
JavaScript
28 lines
880 B
JavaScript
'use strict'
|
|
|
|
var codes = require('../character/codes.js')
|
|
var markdownLineEndingOrSpace = require('../character/markdown-line-ending-or-space.js')
|
|
var unicodePunctuation = require('../character/unicode-punctuation.js')
|
|
var unicodeWhitespace = require('../character/unicode-whitespace.js')
|
|
var constants = require('../constant/constants.js')
|
|
|
|
// Classify whether a character is unicode whitespace, unicode punctuation, or
|
|
// anything else.
|
|
// Used for attention (emphasis, strong), whose sequences can open or close
|
|
// based on the class of surrounding characters.
|
|
function classifyCharacter(code) {
|
|
if (
|
|
code === codes.eof ||
|
|
markdownLineEndingOrSpace(code) ||
|
|
unicodeWhitespace(code)
|
|
) {
|
|
return constants.characterGroupWhitespace
|
|
}
|
|
|
|
if (unicodePunctuation(code)) {
|
|
return constants.characterGroupPunctuation
|
|
}
|
|
}
|
|
|
|
module.exports = classifyCharacter
|