This commit is contained in:
FairyEver 2021-11-08 17:33:27 +08:00
parent 4e9e5a0c96
commit 0d1f635ffa
2 changed files with 5 additions and 4 deletions

View File

@ -1,9 +1,7 @@
import { customAlphabet } from 'nanoid'
import { id } from 'd2/utils/id.js'
import { kebabCase } from 'lodash-es'
import { pascalCase } from 'd2/utils/string.js'
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz', 10)
/**
* Format component name
* @param {string} name simple component name has no prefix
@ -19,7 +17,7 @@ export function makeName (name) {
* @returns {string} component name. eg: 'D2Aisjkxuednj'
*/
export function makeRandomName () {
return makeName(nanoid())
return makeName(id())
}
/**

3
d2/utils/id.js Normal file
View File

@ -0,0 +1,3 @@
import { customAlphabet } from 'nanoid'
export const id = customAlphabet('abcdefghijklmnopqrstuvwxyz', 10)