Auto-fix formatting issues
This commit is contained in:
12
bin/utils/name.ts
vendored
12
bin/utils/name.ts
vendored
@@ -15,15 +15,17 @@ export function generateLinuxPackageName(name: string): string {
|
||||
}
|
||||
|
||||
export function generateIdentifierSafeName(name: string): string {
|
||||
const cleaned = name
|
||||
.replace(/[^a-zA-Z0-9\u4e00-\u9fff]/g, '')
|
||||
.toLowerCase();
|
||||
const cleaned = name.replace(/[^a-zA-Z0-9\u4e00-\u9fff]/g, '').toLowerCase();
|
||||
|
||||
if (cleaned === '') {
|
||||
const fallback = Array.from(name)
|
||||
.map(char => {
|
||||
.map((char) => {
|
||||
const code = char.charCodeAt(0);
|
||||
if ((code >= 48 && code <= 57) || (code >= 65 && code <= 90) || (code >= 97 && code <= 122)) {
|
||||
if (
|
||||
(code >= 48 && code <= 57) ||
|
||||
(code >= 65 && code <= 90) ||
|
||||
(code >= 97 && code <= 122)
|
||||
) {
|
||||
return char.toLowerCase();
|
||||
}
|
||||
return code.toString(16);
|
||||
|
||||
Reference in New Issue
Block a user