Parcourir la source

Add JSON encoding function to external API interface

jherve il y a 1 an
Parent
commit
c7b0bcf7c0
2 fichiers modifiés avec 7 ajouts et 1 suppressions
  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