You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
394 B

(ns blog.helpers
(:require ["date-fns" :refer [format]]))
(defn truncatestring-factory
[]
(fn [text limit]
(-> (. text substring 0 limit)
(str "..."))))
(defn full-timestamp-factory
[]
(clj->js
(fn [timestamp]
(format timestamp "HH:mm MMM. do, yyyy"))))
(defn is-brief-factory
[]
(clj->js
(fn [length]
(if (> length 60)
"..."
""))))