Question

Since cljs doesnt have a format function, I need to define one myself

if i have a src file with following:

(ns formatter
  (:require [goog.string :as gstring]
            [goog.string.format]))

(defn format
  "Formats a string using goog.string.format."
  [fmt & args]
  (apply gstring/format fmt args))

how do I make format function available in all my src files?

Was it helpful?

Solution

You probably should include the namespace and function in each file where you use it, I don't think any other solution would be a good practice.

(ns app.whatever
  (:require [app.utils :only [format]]))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top