Pregunta

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?

¿Fue útil?

Solución

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]]))
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top