CommandSection.tsx15 lines · main
| 1 | import { ICommandSection } from './types' |
| 2 | |
| 3 | const toSectionId = (str: string) => str.toLowerCase().replace(/\s+/g, '-') |
| 4 | |
| 5 | const section$new = ( |
| 6 | name: string, |
| 7 | { forceMount = false, id }: { forceMount?: boolean; id?: string } = {} |
| 8 | ): ICommandSection => ({ |
| 9 | id: id ?? toSectionId(name), |
| 10 | name, |
| 11 | forceMount, |
| 12 | commands: [], |
| 13 | }) |
| 14 | |
| 15 | export { section$new } |