lib/utils/identifierMapping.js
function camelCase(str, { upperCase = false } = {}) {
  if (str.length === 0) {
    return str;
  }

  if (upperCase && isAllUpperCaseSnakeCase(str)) {
    // Only convert to lower case if the string is all upper
    // case snake_case. This allowes camelCase strings to go
    // through without changing.
    str = str.toLowerCase();
  }

  let out = str[0];

  for (let i = 1, l = str.length; i < l; ++i) {
    const char = str[i];
    const prevChar = str[i - 1];

    if (char !== '_') {
      if (prevChar === '_') {
        out += char.toUpperCase();
      } else {
        out += char;
      }
    }
  }

  return out;
}
function camelCase(str, { upperCase = false } = {}) {
  if (str.length === 0) {
    return str;
  }

  if (upperCase && isAllUpperCaseSnakeCase(str)) {
    // Only convert to lower case if the string is all upper
    // case snake_case. This allowes camelCase strings to go
    // through without changing.
    str = str.toLowerCase();
  }

  let out = str[0];

  for (let i = 1, l = str.length; i < l; ++i) {
    const char = str[i];
    const prevChar = str[i - 1];

    if (char !== '_') {
      if (prevChar === '_') {
        out += char.toUpperCase();
      } else {
        out += char;
      }
    }
  }

  return out;
}
function camelCase ( str , { upperCase = false } = { } ) { if ( str . length === 0 ) { return str ; } if ( upperCase && isAllUpperCaseSnakeCase ( str ) ) { // Only convert to lower case if the string is all upper // case snake_case. This allowes camelCase strings to go // through without changing. str = str . toLowerCase ( ) ; } let out = str [ 0 ] ; for ( let i = 1 , l = str . length ; i < l ; ++ i ) { const char = str [ i ] ; const prevChar = str [ i - 1 ] ; if ( char !== '_' ) { if ( prevChar === '_' ) { out += char . toUpperCase ( ) ; } else { out += char ; } } } return out ; }
snake_case to camelCase converter that simply reverses the actions done by `snakeCase` function.
snake_case to camelCase converter that simply reverses the actions done by snakeCase function .