fileoverview author Yosuke Ota
  /**
 * Capitalize a string.
 */ function capitalize ( str ) { return str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ; } /**
 * Checks whether the given string has symbols.
 */ function hasSymbols ( str ) { return /[!"#%&'()*+,./:;<=>?@[\\\]^`{|}]/u . exec ( str ) ; } /**
 * Checks whether the given string has upper.
 */ function hasUpper ( str ) { return /[A-Z]/u . exec ( str ) ; } param { string } str function hasLower ( str ) { return /[a-z]/u . test ( str ) ; } /**
 * Checks whether the given string is kebab-case.
 */ export function isKebabCase ( str ) { if ( hasUpper ( str ) || hasSymbols ( str ) || /^\d/u . exec ( str ) || /^-/u . exec ( str ) || /_|--|\s/u . exec ( str ) ) { return false ; } return true ; } /**
 * Checks whether the given string is snake_case.
 */ export function isSnakeCase ( str ) { if ( hasUpper ( str ) || hasSymbols ( str ) || /^\d/u . exec ( str ) || /-|__|\s/u . exec ( str ) ) { return false ; } return true ; } /**
 * Checks whether the given string is camelCase.
 */ export function isCamelCase ( str ) { if ( hasSymbols ( str ) || /^[A-Z\d]/u . exec ( str ) || /-|_|\s/u . exec ( str ) ) { return false ; } return true ; } /**
 * Checks whether the given string is PascalCase.
 */ export function isPascalCase ( str ) { if ( hasSymbols ( str ) || /^[a-z\d]/u . exec ( str ) || /-|_|\s/u . exec ( str ) ) { return false ; } return true ; } param { string } str export function isScreamingSnakeCase ( str ) { if ( hasLower ( str ) || hasSymbols ( str ) || /-|__|\s/u . test ( str ) ) { return false ; } return true ; } const checkersMap = { 'kebab-case' : isKebabCase , snake_case : isSnakeCase , camelCase : isCamelCase , PascalCase : isPascalCase , SCREAMING_SNAKE_CASE : isScreamingSnakeCase } ; /**
 * Convert text to camelCase
 */ export function camelCase ( str ) { if ( isPascalCase ( str ) ) { return str . charAt ( 0 ) . toLowerCase ( ) + str . slice ( 1 ) ; } return str . replace ( /[-_](\w)/gu , ( _ , c ) => ( c ? c . toUpperCase ( ) : '' ) ) ; } /**
 * Convert text to PascalCase
 */ export function pascalCase ( str ) { return capitalize ( camelCase ( str ) ) ; } export const allowedCaseOptions = [ 'camelCase' , 'kebab-case' , 'PascalCase' , 'snake_case' , 'SCREAMING_SNAKE_CASE' ] as const ; /**
 * Return case checker
 */ export function getCasingChecker ( name ) { return checkersMap [ name ] || isPascalCase ; }