1module Generate.JavaScript.Helpers where
3import Language.ECMAScript3.Syntax
11varDecl :: String -> Expression () -> VarDecl ()
13 VarDecl () (var x) (Just expr)
16make :: [String] -> Expression ()
18 obj (moduleName ++ ["make"]) <| ref localRuntime
21useLazy :: [String] -> String -> Expression ()
22useLazy moduleName functionName =
23 DotRef () (make moduleName) (var functionName)
33ref :: String -> Expression ()
38prop :: String -> Prop ()
46obj :: [String] -> Expression ()
49 x:xs -> foldl (DotRef ()) (ref x) (map var xs)
50 [] -> error "dotSep must be called on a non-empty list of variables"
55(<|) :: Expression () -> Expression () -> Expression ()
60ret :: Expression () -> Statement ()
62 ReturnStmt () (Just e)
65(==>) :: [String] -> Expression () -> Expression ()
67 FuncExpr () Nothing (map var args) [ ret e ]
70function :: [String] -> [Statement ()] -> Expression ()
72 FuncExpr () Nothing (map var args) stmts
75call :: Expression () -> [Expression ()] -> Expression ()
82equal :: Expression () -> Expression () -> Expression ()
84 InfixExpr () OpStrictEq a b
87instanceof :: String -> Expression () -> Expression ()
89 InfixExpr () OpLAnd (typeof "object" x) (InfixExpr () OpInstanceof x (ref tipe))
92typeof :: String -> Expression () -> Expression ()
94 equal (PrefixExpr () PrefixTypeof x) (string tipe)
97member :: String -> Expression () -> Expression ()
99 InfixExpr () OpIn (string field) x
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