0 | module Node.JS.Std.URI
 1 |
 2 | import Node.Internal.Support
 3 |
 4 | public export
 5 | data URIError = MkURIError String
 6 |
 7 | export
 8 | %foreign """
 9 |   node:lambda:
10 |   s => {
11 |     try {
12 |       const result = decodeURI(s);
13 |       return _right(result)
14 |     } catch(e) {
15 |       return _left(e.message)
16 |     }
17 |   }
18 |   """
19 | decodeURI : String -> Either URIError String
20 |
21 | export
22 | %foreign """
23 |   node:lambda:
24 |   s => {
25 |     try {
26 |       const result = decodeURIComponent(s);
27 |       return _right(result)
28 |     } catch(e) {
29 |       return _left(e.message)
30 |     }
31 |   }
32 |   """
33 | decodeURIComponent : String -> Either URIError String
34 |
35 | export
36 | %foreign """
37 |   node:lambda:
38 |   s => {
39 |     try {
40 |       const result = encodeURI(s);
41 |       return _right(result)
42 |     } catch(e) {
43 |       return _left(e.message)
44 |     }
45 |   }
46 |   """
47 | encodeURI : String -> Either URIError String
48 |
49 | export
50 | %foreign """
51 |   node:lambda:
52 |   s => {
53 |     try {
54 |       const result = encodeURIComponent(s);
55 |       return _right(result)
56 |     } catch(e) {
57 |       return _left(e.message)
58 |     }
59 |   }
60 |   """
61 | encodeURIComponent : String -> Either URIError String
62 |