/**
 * Slugify a string: lowercase, non-alphanumerics → single hyphens, trimmed.
 * Shared by the form (name → slug) and repeater (label → value) auto-fill.
 */
export const slugify = ( input ) =>
	String( input ?? '' )
		.toLowerCase()
		.trim()
		.replace( /[^a-z0-9]+/g, '-' )
		.replace( /^-+|-+$/g, '' );

export default slugify;
