Skip to content
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