mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-17 10:56:52 +02:00
19 lines
476 B
TypeScript
19 lines
476 B
TypeScript
import { EVENT_KINDS } from "@/constants/kinds";
|
|
|
|
/**
|
|
* Get all event kinds defined in a specific NIP
|
|
*/
|
|
export function getKindsForNip(nipId: string): number[] {
|
|
const kinds: number[] = [];
|
|
|
|
for (const [kindKey, kindInfo] of Object.entries(EVENT_KINDS)) {
|
|
if (kindInfo.nip === nipId) {
|
|
const kindNum =
|
|
typeof kindInfo.kind === "number" ? kindInfo.kind : parseInt(kindKey);
|
|
kinds.push(kindNum);
|
|
}
|
|
}
|
|
|
|
return kinds.sort((a, b) => a - b);
|
|
}
|