-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGlobal.Unsafe.purs
More file actions
41 lines (33 loc) · 1.79 KB
/
Copy pathGlobal.Unsafe.purs
File metadata and controls
41 lines (33 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module Global.Unsafe where
-- | Uses the global JSON object to turn anything into a string. Careful! Trying
-- | to serialize functions returns undefined
foreign import unsafeStringify :: forall a. a -> String
-- | Formats Number as a String with limited number of digits after the dot.
-- |
-- | May throw RangeError if the number of digits is not within the allowed range
-- | (standard precision range is 0 to 20, but implementations may change it)
foreign import unsafeToFixed :: Int -> Number -> String
-- | Formats Number as String in exponential notation limiting number of digits
-- | after the decimal dot.
-- |
-- | May throw RangeError if the number of digits is not within the allowed range
-- | (standard precision range is 0 to 20, but implementations may change it)
foreign import unsafeToExponential :: Int -> Number -> String
-- | Formats Number as String in fixed-point or exponential notation rounded
-- | to specified number of significant digits.
-- |
-- | May throw RangeError if the number of digits is not within the allowed range
-- | (standard precision range is 0 to 100, but implementations may change it)
foreign import unsafeToPrecision :: Int -> Number -> String
-- | URI decoding. May throw a `URIError` if given a value with undecodeable
-- | escape sequences.
foreign import unsafeDecodeURI :: String -> String
-- | URI encoding. May throw a `URIError` if given a value with unencodeable
-- | characters.
foreign import unsafeEncodeURI :: String -> String
-- | URI component decoding. May throw a `URIError` if given a value with
-- | undecodeable escape sequences.
foreign import unsafeDecodeURIComponent :: String -> String
-- | URI component encoding. May throw a `URIError` if given a value with
-- | unencodeable characters.
foreign import unsafeEncodeURIComponent :: String -> String