mob1
This commit is contained in:
parent
7713afdb38
commit
d270dfcbd0
3 changed files with 17 additions and 19 deletions
|
@ -1,21 +1,17 @@
|
|||
(ns dda.c4k-common.base64
|
||||
(:import (java.util Base64))
|
||||
(:require
|
||||
[orchestra.core :refer [defn-spec]]
|
||||
[orchestra.spec.test :as st]
|
||||
[clojure.spec.alpha :as s]))
|
||||
[orchestra.core :refer [defn-spec]]))
|
||||
|
||||
|
||||
(defn-spec encode string?
|
||||
[string string?]
|
||||
[input string?]
|
||||
(.encodeToString
|
||||
(Base64/getEncoder)
|
||||
(.getBytes string "UTF-8")))
|
||||
(.getBytes input "UTF-8")))
|
||||
|
||||
(defn-spec decode string?
|
||||
[string string?]
|
||||
[input string?]
|
||||
(String.
|
||||
(.decode (Base64/getDecoder) string)
|
||||
(.decode (Base64/getDecoder) input)
|
||||
"UTF-8"))
|
||||
|
||||
(st/instrument)
|
|
@ -4,11 +4,11 @@
|
|||
[clj-yaml.core :as yaml]
|
||||
[clojure.walk]
|
||||
[orchestra.core :refer [defn-spec]]
|
||||
[orchestra.spec.test :as st]
|
||||
[clojure.spec.alpha :as s]))
|
||||
[orchestra.spec.test :as st]))
|
||||
|
||||
|
||||
(defn-spec cast-lazy-seq-to-vec map?
|
||||
|
||||
(defn-spec cast-lazy-seq-to-vec vector?
|
||||
[lazy-seq map?]
|
||||
(clojure.walk/postwalk #(if (instance? clojure.lang.LazySeq %)
|
||||
(into [] %)
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
(ns dda.c4k-common.base64
|
||||
(:require
|
||||
["js-base64" :as b64]))
|
||||
["js-base64" :as b64]
|
||||
[orchestra.core :refer-macros [defn-spec]]))
|
||||
|
||||
(defn encode
|
||||
[string]
|
||||
(.encode b64/Base64 string))
|
||||
|
||||
(defn decode
|
||||
[string]
|
||||
(.decode b64/Base64 string))
|
||||
(defn-spec encode string?
|
||||
[input string?]
|
||||
(.encode b64/Base64 input))
|
||||
|
||||
(defn-spec decode string?
|
||||
[input string?]
|
||||
(.decode b64/Base64 input))
|
||||
|
|
Loading…
Reference in a new issue