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) {
66 } ;
77} ;
88
9- exports . encode = function ( text ) {
10- return text
11- . replace ( '<' , '<' )
12- . replace ( '>' , '>' )
13- . replace ( '&' , '&' )
14- . replace ( '"' , '"' ) ;
15- } ;
16-
179exports . withConsoleImpl = function ( f ) {
1810 return function ( ) {
1911 var oldLog = console . log ;
Original file line number Diff line number Diff line change @@ -20,11 +20,18 @@ module TryPureScript
2020import Prelude
2121import Data.Foldable (class Foldable , foldMap )
2222import Data.String (joinWith )
23+ import Data.String.Common (replace )
24+ import Data.String.Pattern (Pattern (..), Replacement (..))
2325import Effect (Effect )
2426
2527foreign import setInnerHTML :: String -> Effect Unit
2628
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 " "" )
2835
2936foreign import withConsoleImpl
3037 :: forall a
You can’t perform that action at this time.
0 commit comments