@@ -33,6 +33,12 @@ identToJs (Ident name) | nameIsJsReserved name = "$$" ++ name
3333identToJs (Ident name) = concatMap identCharToString name
3434identToJs (Op op) = concatMap identCharToString op
3535
36+-- |
37+-- Test if a string is a valid JS identifier without escaping.
38+--
39+identNeedsEscaping :: String -> Bool
40+identNeedsEscaping s = s /= identToJs (Ident s)
41+
3642-- |
3743-- Attempts to find a human-readable name for a symbol, if none has been specified returns the
3844-- ordinal value.
@@ -130,11 +136,5 @@ nameIsJsReserved name =
130136 , "with"
131137 , "yield" ]
132138
133−-- |
134−-- Test if a string is a valid JS identifier.
135−--
136−isIdent :: String -> Bool
137−isIdent s = identToJs (Ident s) == s
138−
139139moduleNameToJs :: ModuleName -> String
140140moduleNameToJs (ModuleName pns) = intercalate "_" (runProperName `map` pns)