Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert camelCase and snake_case to BIG_SNAKE_CASE #14490

Draft
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions javascript/private/gen_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import re

_copyright = """/*
* Copyright 2011-2014 Software Freedom Conservancy
Expand All @@ -19,9 +20,11 @@
"""

def get_atom_name(name):
# TODO: Convert camelCase and snake_case to BIG_SNAKE_CASE
# Convert camelCase and snake_case to BIG_SNAKE_CASE
name = os.path.basename(name)
return name.upper()
name = re.sub(r'(?<!^)(?<![_-])(?=[A-Z])', '_', name).lower()
name = name.replace('-', '_').upper()
return name

def write_atom_literal(out, name, contents, lang, utf8):
# Escape the contents of the file so it can be stored as a literal.
Expand Down