INNER CODE UNIT · JavaScript

fieldNameMatch

elys-network/elys · scripts/camel2snake/index.js:17

      const fieldNameMatch = line.match(/\b(\w+)\s*=/);
      if (fieldNameMatch) {
        const fieldName = fieldNameMatch[1];
        // Check if the field name is camelCase
        if (/[a-z][A-Z]/.test(fieldName)) {
          // Convert the field name to snake_case
          const snakeCaseName = camelToSnake(fieldName);
          // Replace the field name in the line
          content = content.replace(line, line.replace(fieldName, snakeCaseName));
        }
      }
    });
  }
  return content;
}

// Function to recursively read all .proto files from a directory and its subdirectories
function readProtoFiles(dir) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…