diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-03-20 18:55:32 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-03-20 18:55:32 +0900 |
| commit | abddd40c09c7c48d9c741db9cc322517085d8f67 (patch) | |
| tree | 7e4a595408fb44b1a01da3a60ed4a00d8da01045 /packages/frontend/src/utility/random-id.ts | |
| parent | fix(frontend): MkRoleSelectDialogでのpopupの使い方が誤っているの... (diff) | |
| download | sharkey-abddd40c09c7c48d9c741db9cc322517085d8f67.tar.gz sharkey-abddd40c09c7c48d9c741db9cc322517085d8f67.tar.bz2 sharkey-abddd40c09c7c48d9c741db9cc322517085d8f67.zip | |
enhance(frontend): 通常のRouterViewにTransitionを追加
Diffstat (limited to 'packages/frontend/src/utility/random-id.ts')
| -rw-r--r-- | packages/frontend/src/utility/random-id.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/frontend/src/utility/random-id.ts b/packages/frontend/src/utility/random-id.ts new file mode 100644 index 0000000000..4e5943a97f --- /dev/null +++ b/packages/frontend/src/utility/random-id.ts @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +const CHARS = 'abcdefghijklmnopqrstuvwxyz'; // CSSの<custom-ident>などで使われることもあるのでa-z以外使うな + +export function randomId(length = 32, characters = CHARS) { + let result = ''; + const charactersLength = characters.length; + for ( let i = 0; i < length; i++ ) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; +} |