Skip to content

Commit 3298686

Browse files
committed
convert to BIG_SNAKE_CASE
1 parent 05bce9b commit 3298686

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

javascript/private/gen_file.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
import re
34

45
_copyright = """/*
56
* Copyright 2011-2014 Software Freedom Conservancy
@@ -19,9 +20,11 @@
1920
"""
2021

2122
def get_atom_name(name):
22-
# TODO: Convert camelCase and snake_case to BIG_SNAKE_CASE
23+
# Convert camelCase and snake_case to BIG_SNAKE_CASE
2324
name = os.path.basename(name)
24-
return name.upper()
25+
name = re.sub(r'(?<!^)(?=[A-Z])', '_', name).lower()
26+
name = name.replace('-', '_').upper()
27+
return name
2528

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

0 commit comments

Comments
 (0)