mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 16:55:46 +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>
22 lines
687 B
JavaScript
22 lines
687 B
JavaScript
export default normalizeIdentifier
|
|
|
|
import values from '../character/values.mjs'
|
|
|
|
function normalizeIdentifier(value) {
|
|
return (
|
|
value
|
|
// Collapse Markdown whitespace.
|
|
.replace(/[\t\n\r ]+/g, values.space)
|
|
// Trim.
|
|
.replace(/^ | $/g, '')
|
|
// Some characters are considered “uppercase”, but if their lowercase
|
|
// counterpart is uppercased will result in a different uppercase
|
|
// character.
|
|
// Hence, to get that form, we perform both lower- and uppercase.
|
|
// Upper case makes sure keys will not interact with default prototypal
|
|
// methods: no object method is uppercase.
|
|
.toLowerCase()
|
|
.toUpperCase()
|
|
)
|
|
}
|