Giter VIP home page Giter VIP logo

useful's Introduction

Useful

A collection of generally-useful Clojure utility functions.

Clojars Project cljdoc badge CircleCI

History

useful was originally created by Alan Malloy and was part of the flatland organisation. In December 2018 it was moved to CLJ Commons for continued maintenance.

It could previously be found at amalloy/useful and flatland/useful. clj-commons/useful is the canonical repository now.

useful's People

Contributors

amalloy avatar arrdem avatar bmabey avatar danielcompton avatar djui avatar glenjamin avatar jafingerhut avatar jeremyheiler avatar lancepantz avatar michalmarczyk avatar ninjudd avatar raynes avatar sjl avatar slipset avatar thenonameguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

useful's Issues

Copyright holders

I am a Debian developer packaging Clojure and Leiningen. Leiningen2 depends on this project and I'd like to package it. Could you please display copyright holders (developers) for this work? project.clj is likely a good place to note that.

Move away from sun.misc.Base64decoder

On Java 11 and 12-ea:

 java.lang.ClassNotFoundException: sun.misc.BASE64Decoder, compiling:(flatland/useful/compress.clj:1:1)

java.util.Base64 would be good, but it's only available on Java 8 onwards. Probably still the best choice, but would mean dropping support for Java 7 and down, at least for the flatland.compress namespace.

ignoring-nils

((ignoring-nils +) nil nil) returns 0, but ((ignoring-nils +) nil nil nil) returns nil. Is this difference intentional? I figure they should both return 0.

Transform ALL keys in map

Right now the map-keys function only maps the top keys, i.e:

(map-keys str {:a {:b "c"}})
=> {"a" {:b "c"}}

Can we consider adding something like map-all-keys, map-all-values, etc that will traverse a nested structure? The use case here could be transforming a clojurefied map into a formatted JSON object or vise versa for example.

(defn transform-keys
  "Recursively transforms all map keys in coll with t."
  [t coll]
  (let [f (fn [[k v]] [(t k) v])]
    (clojure.walk/postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) coll)))

(transform-keys ->kebab-case-keyword {"oneTwo" 12 "threeFour" {"fiveSix" 56}})
=> {:three-four {:five-six 56}, :one-two 12}

OR

(defn transform-keys 
  "Recursively transforms all map keys in m with f."
  [f m]
  (letfn [(mapper [[k v]] [(f k) (if (map? v) (map-keys f v) v)])]
    (into {} (map mapper m))))

(transform-keys ->kebab-case-keyword {"oneTwo" 12 "threeFour" {"fiveSix" 56}})
=> {:three-four {:five-six 56}, :one-two 12}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.