Hump underlined (js)

sellerCnt = > seller_cnt
minPriceOne= > min_price_one
as mentioned above, the effect is like this. Change uppercase letters to lowercase, and then add a _ how to encapsulate a function before uppercase letters.
I"ve tried it several times, but it"s not perfect. Let"s be a hand-holding party. I hope to pass the trial.

Aug.07,2021

function underline(str){
  return str.replace(/\B([A-Z])/g, '_$1').toLowerCase()
}

an immature function

function fn (str) {
   if (!str) {
        return str
   }
   
   return str.replace(/[A-Z]/g, (match) => {
     return `_${match.toLowerCase()}`
   })
}

formatUpper(str){
    let myStr = '';
    let myItem = ''
    for (const item of str) {
      myItem = /[A-Z]/.test(item) ? `_${item.toLowerCase()}` : item;
      myStr += myItem;
    }
    return myStr
  }

it is recommended to use the npm package humps . There are many ways to handle this kind of conversion. Please refer to the code below https://www.npmjs.com/package.
for underlining the hump.

It is also available on
  name-styles  
NPM: npm install name-styles

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf5fcd-31fc2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf5fcd-31fc2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?