Fork me on GitHub

I wanted to split my project into a muti-project I am able to split the CLJS files into a separate project, then build it(create jar) and add it as a dependency in my main project Now I am struggling with two things 1) Can I split the generic less files also into a generic project ? We have a generic CSS framework which are not tied to the components, so the project will just contain less files. 2) In my multi project, when I update the sub project CLJS files, I dont want to go through the entire deploy and import process. I tried the checkouts folder which is mentioned in the lein docs, but its not working for me


How can I get a map from a vector of maps based on value of a key? {:data [{:id 1 :b 2 :c "some string"} {:id 2 :b 4 :c "some other string string"} ...]} How can I extract for example {:id 1 :b 2 :c "some string"} By the value of the key :id


I feel like an idiot for asking but I could not find anything remotely usefull on google... 🤐


@eveko You can use (some #(= 1 (:id %)) vec-of-maps)


some returns a truthy value as long as there is at least one value in the collection for which the predicate is true. It just so happens to return the first matching element as that truthy value


Alternatively, you could do something like: (first (filter #(= 1 (:id %)) vec-of-maps))


Since filter is lazy, it will only process up until the first value found. I prefer some, however. It's a bit more concise, and I think I've run into issues with filter or other similar transducers processing batches of data (so you may process more elements than you actually consume sometimes)


the first one is returning true for some reason though


Oh, oops, let me rewrite. I forgot it returns the result of the predicate, which in this case is a boolean since I am using equals


(some (fn [x] (when (= 1 (:id x)) x)) vec-of-maps)


At that point it's less concise though. Pick your poison 🙂


Could rename it into a function


thanks allot it works great. This really should have been easier to find online 😮


Hi. Is there a recommended way to do multilingual routing in cljs?