purescript-0.12.0: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.CodeGen.JS.Common

Description

Common code generation utility functions

Synopsis

Documentation

identToJs :: Ident -> Text Source #

Convert an Ident into a valid JavaScript identifier:

  • Alphanumeric characters are kept unmodified.
  • Reserved javascript identifiers are prefixed with $$.
  • Symbols are prefixed with $ followed by a symbol name or their ordinal value.

identNeedsEscaping :: Text -> Bool Source #

Test if a string is a valid AST identifier without escaping.

identCharToText :: Char -> Text Source #

Attempts to find a human-readable name for a symbol, if none has been specified returns the ordinal value.

nameIsJsReserved :: Text -> Bool Source #

Checks whether an identifier name is reserved in JavaScript.

nameIsJsBuiltIn :: Text -> Bool Source #

Checks whether a name matches a built-in value in JavaScript.