junkcode  Check-in [6cffa263b3]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:let -> when-let
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6cffa263b38f5d41c0303daae2a920f45edeb4f200abc934cf9584fbc7103dd7
User & Date: jaccarmac 2019-08-01 18:05:19.588
Context
2019-08-01
18:32
Move go block. check-in: e0e4f7b2a3 user: jaccarmac tags: trunk
18:05
let -> when-let check-in: 6cffa263b3 user: jaccarmac tags: trunk
18:02
Factor out take! check-in: c4d18d872e user: jaccarmac tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to pdf-invoice-extract/src/extract.cljs.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    (let [data-chan (chan)]
      (.extract (new PDFExtract)
                fn
                #js{}
                #(do (if %1
                       (println %1)
                       (put! data-chan %2))))
      (let [data (<! data-chan)]
        ;; the format we need to pull out is after a string content of "ea"
        ;; table fmt is "ea", name, type, # ordered, # shipped, id, # U/M, total price, retail price, extended price
        (map #(.-str %) (.-content (first (.-pages data))))))))

(defn main [& cli-args]
  (go (println (<! (extract (first cli-args))))))







|






8
9
10
11
12
13
14
15
16
17
18
19
20
21
    (let [data-chan (chan)]
      (.extract (new PDFExtract)
                fn
                #js{}
                #(do (if %1
                       (println %1)
                       (put! data-chan %2))))
      (when-let [data (<! data-chan)]
        ;; the format we need to pull out is after a string content of "ea"
        ;; table fmt is "ea", name, type, # ordered, # shipped, id, # U/M, total price, retail price, extended price
        (map #(.-str %) (.-content (first (.-pages data))))))))

(defn main [& cli-args]
  (go (println (<! (extract (first cli-args))))))