File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,6 @@ exports.setInnerHTML = function(html) {
6
6
} ;
7
7
} ;
8
8
9
- exports . encode = function ( text ) {
10
- return text
11
- . replace ( '<' , '<' )
12
- . replace ( '>' , '>' )
13
- . replace ( '&' , '&' )
14
- . replace ( '"' , '"' ) ;
15
- } ;
16
-
17
9
exports . withConsoleImpl = function ( f ) {
18
10
return function ( ) {
19
11
var oldLog = console . log ;
Original file line number Diff line number Diff line change @@ -20,11 +20,18 @@ module TryPureScript
20
20
import Prelude
21
21
import Data.Foldable (class Foldable , foldMap )
22
22
import Data.String (joinWith )
23
+ import Data.String.Common (replace )
24
+ import Data.String.Pattern (Pattern (..), Replacement (..))
23
25
import Effect (Effect )
24
26
25
27
foreign import setInnerHTML :: String -> Effect Unit
26
28
27
- foreign import encode :: String -> String
29
+ encode :: String -> String
30
+ encode =
31
+ replace (Pattern " <" ) (Replacement " <" )
32
+ <<< replace (Pattern " >" ) (Replacement " >" )
33
+ <<< replace (Pattern " &" ) (Replacement " &" )
34
+ <<< replace (Pattern " \" " ) (Replacement " "" )
28
35
29
36
foreign import withConsoleImpl
30
37
:: forall a
You can’t perform that action at this time.
0 commit comments