[Fix #3076] Separate figwheel from dev lein profile
Signed-off-by: Dmitry Novotochinov <trybeee@gmail.com>
This commit is contained in:
parent
03e62548a6
commit
ae04dde8ba
|
@ -2,7 +2,8 @@
|
||||||
(:use [figwheel-sidecar.repl-api :as ra])
|
(:use [figwheel-sidecar.repl-api :as ra])
|
||||||
(:require [hawk.core :as hawk]
|
(:require [hawk.core :as hawk]
|
||||||
[re-frisk-sidecar.core :as rfs]
|
[re-frisk-sidecar.core :as rfs]
|
||||||
[clojure.string :as s]))
|
[clojure.string :as s]
|
||||||
|
[status-im.utils.core :as utils]))
|
||||||
|
|
||||||
(defn get-test-build [build]
|
(defn get-test-build [build]
|
||||||
(update build :source-paths
|
(update build :source-paths
|
||||||
|
@ -59,14 +60,16 @@
|
||||||
(spit path js-resourced))
|
(spit path js-resourced))
|
||||||
ctx)}])
|
ctx)}])
|
||||||
;; read project.clj to get build configs
|
;; read project.clj to get build configs
|
||||||
(let [profiles (->> "project.clj"
|
(let [profiles (->> "project.clj"
|
||||||
slurp
|
slurp
|
||||||
read-string
|
read-string
|
||||||
(drop-while #(not= % :profiles))
|
(drop-while #(not= % :profiles))
|
||||||
(apply hash-map)
|
(apply hash-map)
|
||||||
:profiles)
|
:profiles)
|
||||||
cljs-builds (get-in profiles [:dev :cljsbuild :builds])
|
dev-cljs-builds (get-in profiles [:dev :cljsbuild :builds])
|
||||||
builds (get-builds build-ids cljs-builds)]
|
fig-cljs-builds (get-in profiles [:figwheel 1 :cljsbuild :builds])
|
||||||
|
cljs-builds (utils/deep-merge dev-cljs-builds fig-cljs-builds)
|
||||||
|
builds (get-builds build-ids cljs-builds)]
|
||||||
(start-figwheel build-ids builds)
|
(start-figwheel build-ids builds)
|
||||||
(rfs/-main))))
|
(rfs/-main))))
|
||||||
|
|
||||||
|
|
163
project.clj
163
project.clj
|
@ -14,86 +14,91 @@
|
||||||
:plugins [[lein-cljsbuild "1.1.7"]
|
:plugins [[lein-cljsbuild "1.1.7"]
|
||||||
[lein-re-frisk "0.5.5"]]
|
[lein-re-frisk "0.5.5"]]
|
||||||
:clean-targets ["target/" "index.ios.js" "index.android.js"]
|
:clean-targets ["target/" "index.ios.js" "index.android.js"]
|
||||||
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
||||||
["do" "clean"
|
["do" "clean"
|
||||||
["with-profile" "prod" "cljsbuild" "once" "ios"]
|
["with-profile" "prod" "cljsbuild" "once" "ios"]
|
||||||
["with-profile" "prod" "cljsbuild" "once" "android"]]
|
["with-profile" "prod" "cljsbuild" "once" "android"]]
|
||||||
"figwheel-repl" ["run" "-m" "clojure.main" "env/dev/run.clj"]
|
"figwheel-repl" ["with-profile" "+figwheel" "run" "-m" "clojure.main" "env/dev/run.clj"]
|
||||||
"test-cljs" ["with-profile" "test" "doo" "node" "test" "once"]
|
"test-cljs" ["with-profile" "test" "doo" "node" "test" "once"]
|
||||||
"test-protocol" ["with-profile" "test" "doo" "node" "protocol" "once"]
|
"test-protocol" ["with-profile" "test" "doo" "node" "protocol" "once"]
|
||||||
"test-env-dev-utils" ["with-profile" "test" "doo" "node" "env-dev-utils" "once"]}
|
"test-env-dev-utils" ["with-profile" "test" "doo" "node" "env-dev-utils" "once"]}
|
||||||
:figwheel {:nrepl-port 7888}
|
:profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.2"]]
|
||||||
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.14"]
|
:cljsbuild {:builds
|
||||||
[re-frisk-remote "0.5.3"]
|
{:ios
|
||||||
[re-frisk-sidecar "0.5.4"]
|
{:source-paths ["react-native/src" "src"]
|
||||||
[com.cemerick/piggieback "0.2.2"]
|
:compiler {:output-to "target/ios/app.js"
|
||||||
[hawk "0.2.11"]]
|
:main "env.ios.main"
|
||||||
:source-paths ["src" "env/dev"]
|
:output-dir "target/ios"
|
||||||
:cljsbuild {:builds
|
:optimizations :none}}
|
||||||
{:ios
|
:android
|
||||||
{:source-paths ["react-native/src" "src" "env/dev"]
|
{:source-paths ["react-native/src" "src"]
|
||||||
:figwheel true
|
:compiler {:output-to "target/android/app.js"
|
||||||
:compiler {:output-to "target/ios/app.js"
|
:main "env.android.main"
|
||||||
:main "env.ios.main"
|
:output-dir "target/android"
|
||||||
:output-dir "target/ios"
|
:optimizations :none}
|
||||||
:optimizations :none}}
|
:warning-handlers [status-im.utils.build/warning-handler]}}}
|
||||||
:android
|
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]
|
||||||
{:source-paths ["react-native/src" "src" "env/dev"]
|
:timeout 240000}}
|
||||||
:figwheel true
|
:figwheel [:dev
|
||||||
:compiler {:output-to "target/android/app.js"
|
{:dependencies [[figwheel-sidecar "0.5.14"]
|
||||||
:main "env.android.main"
|
[re-frisk-remote "0.5.3"]
|
||||||
:output-dir "target/android"
|
[re-frisk-sidecar "0.5.4"]
|
||||||
:optimizations :none}
|
[hawk "0.2.11"]]
|
||||||
:warning-handlers [status-im.utils.build/warning-handler]}}}
|
:source-paths ["src" "env/dev"]
|
||||||
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]
|
:cljsbuild {:builds
|
||||||
:timeout 240000}}
|
{:ios
|
||||||
:test {:dependencies [[day8.re-frame/test "0.1.5"]]
|
{:source-paths ["react-native/src" "src" "env/dev"]
|
||||||
:plugins [[lein-doo "0.1.7"]]
|
:figwheel true}
|
||||||
:cljsbuild {:builds
|
:android
|
||||||
[{:id "test"
|
{:source-paths ["react-native/src" "src" "env/dev"]
|
||||||
:source-paths ["src" "test/cljs"]
|
:figwheel true}}}}]
|
||||||
:compiler {:main status-im.test.runner
|
:test {:dependencies [[day8.re-frame/test "0.1.5"]]
|
||||||
:output-to "target/test/test.js"
|
:plugins [[lein-doo "0.1.7"]]
|
||||||
:output-dir "target/test"
|
:cljsbuild {:builds
|
||||||
:optimizations :none
|
[{:id "test"
|
||||||
:preamble ["js/hook-require.js"]
|
:source-paths ["src" "test/cljs"]
|
||||||
:target :nodejs}}
|
:compiler {:main status-im.test.runner
|
||||||
{:id "protocol"
|
:output-to "target/test/test.js"
|
||||||
:source-paths ["src" "test/cljs"]
|
:output-dir "target/test"
|
||||||
:compiler {:main status-im.test.protocol.runner
|
:optimizations :none
|
||||||
:output-to "target/test/test.js"
|
:preamble ["js/hook-require.js"]
|
||||||
:output-dir "target/test"
|
:target :nodejs}}
|
||||||
:optimizations :none
|
{:id "protocol"
|
||||||
:target :nodejs}}
|
:source-paths ["src" "test/cljs"]
|
||||||
{:id "env-dev-utils"
|
:compiler {:main status-im.test.protocol.runner
|
||||||
:source-paths ["env/dev/env/utils.cljs" "test/env/dev"]
|
:output-to "target/test/test.js"
|
||||||
:compiler {:main env.test.runner
|
:output-dir "target/test"
|
||||||
:output-to "target/test/test.js"
|
:optimizations :none
|
||||||
:output-dir "target/test"
|
:target :nodejs}}
|
||||||
:optimizations :none
|
{:id "env-dev-utils"
|
||||||
:target :nodejs}}]}}
|
:source-paths ["env/dev/env/utils.cljs" "test/env/dev"]
|
||||||
:prod {:cljsbuild {:builds
|
:compiler {:main env.test.runner
|
||||||
{:ios
|
:output-to "target/test/test.js"
|
||||||
{:source-paths ["react-native/src" "src" "env/prod"]
|
:output-dir "target/test"
|
||||||
:compiler {:output-to "index.ios.js"
|
:optimizations :none
|
||||||
:main "env.ios.main"
|
:target :nodejs}}]}}
|
||||||
:output-dir "target/ios-prod"
|
:prod {:cljsbuild {:builds
|
||||||
:static-fns true
|
{:ios
|
||||||
:optimize-constants true
|
{:source-paths ["react-native/src" "src" "env/prod"]
|
||||||
:optimizations :simple
|
:compiler {:output-to "index.ios.js"
|
||||||
:closure-defines {"goog.DEBUG" false}
|
:main "env.ios.main"
|
||||||
:parallel-build false
|
:output-dir "target/ios-prod"
|
||||||
:language-in :ecmascript5}
|
:static-fns true
|
||||||
:warning-handlers [status-im.utils.build/warning-handler]}
|
:optimize-constants true
|
||||||
:android
|
:optimizations :simple
|
||||||
{:source-paths ["react-native/src" "src" "env/prod"]
|
:closure-defines {"goog.DEBUG" false}
|
||||||
:compiler {:output-to "index.android.js"
|
:parallel-build false
|
||||||
:main "env.android.main"
|
:language-in :ecmascript5}
|
||||||
:output-dir "target/android-prod"
|
:warning-handlers [status-im.utils.build/warning-handler]}
|
||||||
:static-fns true
|
:android
|
||||||
:optimize-constants true
|
{:source-paths ["react-native/src" "src" "env/prod"]
|
||||||
:optimizations :simple
|
:compiler {:output-to "index.android.js"
|
||||||
:closure-defines {"goog.DEBUG" false}
|
:main "env.android.main"
|
||||||
:parallel-build false
|
:output-dir "target/android-prod"
|
||||||
:language-in :ecmascript5}
|
:static-fns true
|
||||||
:warning-handlers [status-im.utils.build/warning-handler]}}}}})
|
:optimize-constants true
|
||||||
|
:optimizations :simple
|
||||||
|
:closure-defines {"goog.DEBUG" false}
|
||||||
|
:parallel-build false
|
||||||
|
:language-in :ecmascript5}
|
||||||
|
:warning-handlers [status-im.utils.build/warning-handler]}}}}})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.bots.events
|
(ns status-im.bots.events
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[status-im.utils.handlers :as handlers]
|
[status-im.utils.handlers :as handlers]
|
||||||
[status-im.chat.models.input :as input-model]
|
[status-im.chat.models.input :as input-model]
|
||||||
[taoensso.timbre :as log]))
|
[taoensso.timbre :as log]))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.ui.components.animation :as anim]
|
[status-im.ui.components.animation :as anim]
|
||||||
[status-im.ui.components.list.views :as list]
|
[status-im.ui.components.list.views :as list]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[status-im.utils.identicon :as identicon]))
|
[status-im.utils.identicon :as identicon]))
|
||||||
|
|
||||||
(defn- container-animation-logic [{:keys [to-value val]}]
|
(defn- container-animation-logic [{:keys [to-value val]}]
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
[status-im.constants :as constants]
|
[status-im.constants :as constants]
|
||||||
[status-im.data-store.realm.messages :as data-store]
|
[status-im.data-store.realm.messages :as data-store]
|
||||||
[status-im.utils.random :as random]
|
[status-im.utils.random :as random]
|
||||||
[status-im.utils.utils :as utils]))
|
[status-im.utils.core :as utils]))
|
||||||
|
|
||||||
(defn- command-type?
|
(defn- command-type?
|
||||||
[type]
|
[type]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.ios.platform
|
(ns status-im.ios.platform
|
||||||
(:require [status-im.i18n :refer [label]]
|
(:require [status-im.i18n :refer [label]]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[status-im.react-native.js-dependencies :as rn-dependencies]))
|
[status-im.react-native.js-dependencies :as rn-dependencies]))
|
||||||
|
|
||||||
(def fonts
|
(def fonts
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.ui.components.action-sheet
|
(ns status-im.ui.components.action-sheet
|
||||||
(:require [status-im.i18n :as i18n]
|
(:require [status-im.i18n :as i18n]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[status-im.react-native.js-dependencies :as rn-dependencies]))
|
[status-im.react-native.js-dependencies :as rn-dependencies]))
|
||||||
|
|
||||||
(defn- callback [options]
|
(defn- callback [options]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(ns status-im.ui.components.chat-preview
|
(ns status-im.ui.components.chat-preview
|
||||||
(:require [status-im.ui.components.react :as components]
|
(:require [status-im.ui.components.react :as components]
|
||||||
[status-im.ui.screens.home.styles :as home.styles]
|
[status-im.ui.screens.home.styles :as home.styles]
|
||||||
[status-im.utils.utils :as utils]))
|
[status-im.utils.core :as utils]))
|
||||||
|
|
||||||
(def default-attributes
|
(def default-attributes
|
||||||
{:style home.styles/last-message-text
|
{:style home.styles/last-message-text
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
[status-im.ui.components.react :refer [view text]]
|
[status-im.ui.components.react :refer [view text]]
|
||||||
[status-im.utils.platform :refer [platform-specific]]
|
[status-im.utils.platform :refer [platform-specific]]
|
||||||
[status-im.ui.components.styles :refer [color-blue color-black color-blue4-faded]]
|
[status-im.ui.components.styles :refer [color-blue color-black color-blue4-faded]]
|
||||||
[status-im.utils.utils :refer [hash-tag?]]))
|
[status-im.utils.core :refer [hash-tag?]]))
|
||||||
|
|
||||||
(defn tag-view [tag]
|
(defn tag-view [tag]
|
||||||
[text {:style {:color color-blue4-faded}
|
[text {:style {:color color-blue4-faded}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:require-macros [status-im.utils.styles :refer [defstyle defnstyle]])
|
(:require-macros [status-im.utils.styles :refer [defstyle defnstyle]])
|
||||||
(:require [status-im.ui.components.styles :as common]
|
(:require [status-im.ui.components.styles :as common]
|
||||||
[status-im.utils.platform :refer [platform-specific]]
|
[status-im.utils.platform :refer [platform-specific]]
|
||||||
[status-im.utils.utils :as u]
|
[status-im.utils.core :as u]
|
||||||
[status-im.ui.components.react :as react]))
|
[status-im.ui.components.react :as react]))
|
||||||
|
|
||||||
(def sticky-button-style
|
(def sticky-button-style
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
[status-im.ui.components.context-menu :as context-menu]
|
[status-im.ui.components.context-menu :as context-menu]
|
||||||
[status-im.ui.screens.home.styles :as styles]
|
[status-im.ui.screens.home.styles :as styles]
|
||||||
[status-im.ui.components.styles :as component.styles]
|
[status-im.ui.components.styles :as component.styles]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[status-im.commands.utils :as commands-utils]
|
[status-im.commands.utils :as commands-utils]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.utils.datetime :as time]
|
[status-im.utils.datetime :as time]
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
[status-im.utils.gfycat.core :as gfycat]
|
[status-im.utils.gfycat.core :as gfycat]
|
||||||
[status-im.utils.handlers :as handlers]
|
[status-im.utils.handlers :as handlers]
|
||||||
[status-im.utils.image-processing :refer [img->base64]]
|
[status-im.utils.image-processing :refer [img->base64]]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.core :as utils]
|
||||||
[taoensso.timbre :as log]))
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
[status-im.ui.screens.profile.styles :as styles]
|
[status-im.ui.screens.profile.styles :as styles]
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.colors :as colors]
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.utils :as utils]
|
||||||
|
[status-im.utils.core :refer [hash-tag?]]
|
||||||
[status-im.utils.datetime :as time]
|
[status-im.utils.datetime :as time]
|
||||||
[status-im.utils.config :as config]
|
[status-im.utils.config :as config]
|
||||||
[status-im.utils.platform :as platform]
|
[status-im.utils.platform :as platform]
|
||||||
|
@ -194,7 +195,7 @@
|
||||||
|
|
||||||
(defn colorize-status-hashtags [status]
|
(defn colorize-status-hashtags [status]
|
||||||
(for [[i status] (map-indexed vector (string/split status #" "))]
|
(for [[i status] (map-indexed vector (string/split status #" "))]
|
||||||
(if (utils/hash-tag? status)
|
(if (hash-tag? status)
|
||||||
^{:key (str "item-" i)}
|
^{:key (str "item-" i)}
|
||||||
[tag-view status]
|
[tag-view status]
|
||||||
^{:key (str "item-" i)}
|
^{:key (str "item-" i)}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
(ns status-im.utils.core
|
||||||
|
(:require [clojure.string :as str]))
|
||||||
|
|
||||||
|
(defn truncate-str
|
||||||
|
"Given string and max threshold, trims the string to threshold length with `...`
|
||||||
|
appended to end if length of the string exceeds max threshold, returns the same
|
||||||
|
string if threshold is not exceeded"
|
||||||
|
[s threshold]
|
||||||
|
(if (and s (< threshold (count s)))
|
||||||
|
(str (subs s 0 (- threshold 3)) "...")
|
||||||
|
s))
|
||||||
|
|
||||||
|
(defn clean-text [s]
|
||||||
|
(-> s
|
||||||
|
(str/replace #"\n" "")
|
||||||
|
(str/replace #"\r" "")
|
||||||
|
(str/trim)))
|
||||||
|
|
||||||
|
(defn first-index
|
||||||
|
"Returns first index in coll where predicate on coll element is truthy"
|
||||||
|
[pred coll]
|
||||||
|
(->> coll
|
||||||
|
(keep-indexed (fn [idx e]
|
||||||
|
(when (pred e)
|
||||||
|
idx)))
|
||||||
|
first))
|
||||||
|
|
||||||
|
(defn hash-tag? [s]
|
||||||
|
(= \# (first s)))
|
||||||
|
|
||||||
|
(defn wrap-call-once!
|
||||||
|
"Returns a version of provided function that will be called only the first time wrapping function is called. Returns nil."
|
||||||
|
[f]
|
||||||
|
(let [called? (volatile! false)]
|
||||||
|
(fn [& args]
|
||||||
|
(when-not @called?
|
||||||
|
(vreset! called? true)
|
||||||
|
(apply f args)
|
||||||
|
nil))))
|
||||||
|
|
||||||
|
(defn update-if-present
|
||||||
|
"Like regular `clojure.core/update` but returns original map if update key is not present"
|
||||||
|
[m k f & args]
|
||||||
|
(if (contains? m k)
|
||||||
|
(apply update m k f args)
|
||||||
|
m))
|
||||||
|
|
||||||
|
(defn map-values
|
||||||
|
"Efficiently apply function to all map values"
|
||||||
|
[m f]
|
||||||
|
(into {}
|
||||||
|
(map (fn [[k v]]
|
||||||
|
[k (f v)]))
|
||||||
|
m))
|
||||||
|
|
||||||
|
(defn deep-merge
|
||||||
|
"Recursively merge maps"
|
||||||
|
[& maps]
|
||||||
|
(if (every? map? maps)
|
||||||
|
(apply merge-with deep-merge maps)
|
||||||
|
(last maps)))
|
|
@ -1,7 +1,6 @@
|
||||||
(ns status-im.utils.utils
|
(ns status-im.utils.utils
|
||||||
(:require [status-im.constants :as const]
|
(:require [status-im.constants :as const]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[clojure.string :as str]
|
|
||||||
[status-im.react-native.js-dependencies :as rn-dependencies]))
|
[status-im.react-native.js-dependencies :as rn-dependencies]))
|
||||||
|
|
||||||
(defn show-popup [title content]
|
(defn show-popup [title content]
|
||||||
|
@ -81,62 +80,3 @@
|
||||||
(.catch (or on-error
|
(.catch (or on-error
|
||||||
(fn [error]
|
(fn [error]
|
||||||
(show-popup "Error" (str error))))))))
|
(show-popup "Error" (str error))))))))
|
||||||
|
|
||||||
(defn truncate-str
|
|
||||||
"Given string and max threshold, trims the string to threshold length with `...`
|
|
||||||
appended to end if length of the string exceeds max threshold, returns the same
|
|
||||||
string if threshold is not exceeded"
|
|
||||||
[s threshold]
|
|
||||||
(if (and s (< threshold (count s)))
|
|
||||||
(str (subs s 0 (- threshold 3)) "...")
|
|
||||||
s))
|
|
||||||
|
|
||||||
(defn clean-text [s]
|
|
||||||
(-> s
|
|
||||||
(str/replace #"\n" "")
|
|
||||||
(str/replace #"\r" "")
|
|
||||||
(str/trim)))
|
|
||||||
|
|
||||||
(defn first-index
|
|
||||||
"Returns first index in coll where predicate on coll element is truthy"
|
|
||||||
[pred coll]
|
|
||||||
(->> coll
|
|
||||||
(keep-indexed (fn [idx e]
|
|
||||||
(when (pred e)
|
|
||||||
idx)))
|
|
||||||
first))
|
|
||||||
|
|
||||||
(defn hash-tag? [s]
|
|
||||||
(= \# (first s)))
|
|
||||||
|
|
||||||
(defn wrap-call-once!
|
|
||||||
"Returns a version of provided function that will be called only the first time wrapping function is called. Returns nil."
|
|
||||||
[f]
|
|
||||||
(let [called? (volatile! false)]
|
|
||||||
(fn [& args]
|
|
||||||
(when-not @called?
|
|
||||||
(vreset! called? true)
|
|
||||||
(apply f args)
|
|
||||||
nil))))
|
|
||||||
|
|
||||||
(defn update-if-present
|
|
||||||
"Like regular `clojure.core/update` but returns original map if update key is not present"
|
|
||||||
[m k f & args]
|
|
||||||
(if (contains? m k)
|
|
||||||
(apply update m k f args)
|
|
||||||
m))
|
|
||||||
|
|
||||||
(defn map-values
|
|
||||||
"Efficiently apply function to all map values"
|
|
||||||
[m f]
|
|
||||||
(into {}
|
|
||||||
(map (fn [[k v]]
|
|
||||||
[k (f v)]))
|
|
||||||
m))
|
|
||||||
|
|
||||||
(defn deep-merge
|
|
||||||
"Recursively merge maps"
|
|
||||||
[& maps]
|
|
||||||
(if (every? map? maps)
|
|
||||||
(apply merge-with deep-merge maps)
|
|
||||||
(last maps)))
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.test.utils.utils
|
(ns status-im.test.utils.utils
|
||||||
(:require [cljs.test :refer-macros [deftest is]]
|
(:require [cljs.test :refer-macros [deftest is]]
|
||||||
[status-im.utils.utils :as u]))
|
[status-im.utils.core :as u]))
|
||||||
|
|
||||||
(deftest wrap-as-call-once-test
|
(deftest wrap-as-call-once-test
|
||||||
(let [count (atom 0)]
|
(let [count (atom 0)]
|
||||||
|
|
Loading…
Reference in New Issue