1{-# OPTIONS_GHC -Wall #-}
2module Generate.JavaScript.Helpers
15import qualified Data.Char as Char
16import qualified Data.Text as Text
17import Data.Text (Text)
19import Generate.JavaScript.Builder
26varDecl :: Text -> Expr -> VarDecl
28 VarDecl (Id x) (Just expr)
31refOrObject :: Text -> Expr
33 Infix OpLOr (ref name) (Object [])
45(==>) :: Text -> Expr -> (Id, Expr)
54 foldl DotRef (ref x) (map Id xs)
57 error "dotSep must be called on a non-empty list of variables"
64(<|) :: Expr -> Expr -> Expr
69function :: [Text] -> [Stmt] -> Expr
71 Function Nothing (map Id args) stmts
78toFieldName :: Int -> Text
80 Text.pack (toFieldNameHelp word [])
83toFieldNameHelp :: Int -> [Char] -> [Char]
84toFieldNameHelp word str =
93 toFieldNameHelp next (toChar remainder : str)
98 Char.chr $ fromIntegral $ word + (if word < 26 then 97 else 39)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list