basant307/AI_Governance_Project
048
1import * as is from '../is.mjs';2import { memoize } from './memoize.mjs';3 4export const camel2dash = memoize(str => {5 return str.replace( /([A-Z])/g, v => {6 return '-' + v.toLowerCase();7 } );8});9 10export const dash2camel = memoize(str => {11 return str.replace( /(-\w)/g, v => {12 return v[1].toUpperCase();13 } );14});15 16export const prependCamel = memoize(( prefix, str ) => {17 return prefix + str[0].toUpperCase() + str.substring(1);18}, ( prefix, str ) => {19 return prefix + '$' + str;20});21 22export const capitalize = str => {23 if( is.emptyString( str ) ){24 return str;25 }26 27 return str.charAt( 0 ).toUpperCase() + str.substring( 1 );28};29 30 31export const endsWith = (string, suffix) => string.slice(-1 * suffix.length) === suffix;32 