import toCase from './to-case' ; import { TargetCaseType } from '@commitlint/types' ; export default ensureCase ; function ensureCase ( raw = '' , target = 'lowercase' ) { const input = String ( raw ) . replace ( /`.*?`|".*?"|'.*?'/g , '' ) . trim ( ) ; const transformed = toCase ( input , target ) ; if ( transformed === '' || transformed . match ( /^\d/ ) ) { return true ; } return transformed === input ; }