Skip to content

Commit

Permalink
fix(characterToCodepoint): 用 Array.from 代替 ...
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed May 30, 2023
1 parent 75f6274 commit 5163b7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/characterToCodepoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { padStart } from 'lodash-uni'
* @param character 字符,支持多个字符,返回的码点将以 `-` 分割
*/
export function characterToCodepoint(character: string): string {
return [...character]
return Array.from(character)
.map(char => padStart(char.codePointAt(0)!.toString(16), 4, '0'))
.join('-')
}

0 comments on commit 5163b7c

Please sign in to comment.