bootstrap-5.ts 558 B

1234567891011121314151617181920
  1. import getMeta from '@/utils/meta'
  2. export const isBootstrap5 = getMeta('ol-bootstrapVersion') === 5
  3. export const bsVersion = ({ bs5, bs3 }: { bs5?: string; bs3?: string }) => {
  4. return isBootstrap5 ? bs5 : bs3
  5. }
  6. // get all `aria-*` and `data-*` attributes
  7. export const getAriaAndDataProps = (obj: Record<string, unknown>) => {
  8. return Object.entries(obj).reduce(
  9. (acc, [key, value]) => {
  10. if (key.startsWith('aria-') || key.startsWith('data-')) {
  11. acc[key] = value
  12. }
  13. return acc
  14. },
  15. {} as Record<string, unknown>
  16. )
  17. }