import { Extensions } from "../types" ; const sortArr = ( arr ) => arr . sort ( ( { length : l1 } , { length : l2 } ) => l1 - l2 ) ; const toUniqueArray = ( value ? , sort ? ) => { if ( value ) { const arr = [ ... new Set ( value . trim ( ) . split ( /\s+/ ) ) ] ; if ( sort ) { return sortArr ( arr ) ; } return arr ; } return [ ] ; } ; const toKebabCase = ( string ) => { const matchedStr = string . match ( /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g ) ; return matchedStr ? matchedStr . map ( val => val . toLowerCase ( ) ) . join ( '-' ) : string ; } ; function capitalizeFirstLetter ( string ) { return `${ string . charAt ( 0 ) . toUpperCase ( ) }${ string . slice ( 1 ) }` ; } function unCapitalizeFirstLetter ( string ) { return `${ string . charAt ( 0 ) . toLowerCase ( ) }${ string . slice ( 1 ) }` ; } const getFileExtensions = ( ts , scss ) : Extensions => ( { cmpExt : ts ? 'tsx' : 'js' , fileExt : ts ? 'ts' : 'js' , stylesExt : scss ? 'scss' : 'css' , } ) ; export { sortArr , toKebabCase , toUniqueArray , getFileExtensions , capitalizeFirstLetter , unCapitalizeFirstLetter , } ;