Procházet zdrojové kódy

Add JSON encoding function to external API interface

jherve před 1 rokem
rodič
revize
04b2b0c84a
2 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 1 0
      spago.dhall
  2. 6 1
      src/LinkedIn.purs

+ 1 - 0
spago.dhall

@@ -5,6 +5,7 @@ You can edit this file as you like.
 { name = "web-extension"
 , dependencies =
   [ "argonaut-codecs"
+  , "argonaut-core"
   , "argonaut-generic"
   , "arrays"
   , "assert"

+ 6 - 1
src/LinkedIn.purs

@@ -1,7 +1,9 @@
-module LinkedIn (getContext, extractFromDocument, extractFromDocumentInContext) where
+module LinkedIn (encodeToJson, getContext, extractFromDocument, extractFromDocumentInContext) where
 
 import Prelude
 
+import Data.Argonaut.Core (Json)
+import Data.Argonaut.Encode (encodeJson)
 import Data.Either (Either(..))
 import Data.Maybe (Maybe(..))
 import Effect (Effect)
@@ -32,3 +34,6 @@ extractFromDocument dom = do
 
 extractFromDocumentInContext :: PageUrl -> Document -> Effect (Either String Output)
 extractFromDocumentInContext = toOutput
+
+encodeToJson :: Either String Output -> Json
+encodeToJson = encodeJson