import { UUID } from '../components/ItemContext' ; const DEFAULT = 0 ; let counter = DEFAULT ; export function nextUuid ( ) { const current = counter ; counter = counter + 1 ; return `raa-${ current }` ; } export function resetNextUuid ( ) { counter = DEFAULT ; } const idRegex = /[\u0009\u000a\u000c\u000d\u0020]/g ; export function assertValidHtmlId ( htmlId ) { if ( htmlId === '' || idRegex . test ( htmlId ) ) { console . error ( `uuid must be a valid HTML5 id but was given "${ htmlId }", ASCII whitespaces are forbidden` ) ; return false ; } return true ; }