Skip to content
/ iron Public

Utilities for re-frame and ClojureScript projects

License

Notifications You must be signed in to change notification settings

deg/iron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iron

Introduction

Iron is support for code for my ClojureScript projects; initially for Sodium

Why "Iron"?

Sodium came first, and got its name from React, Soda-ash, and Semantic-UI. See its readme for the punny details.

Iron is intended to hold the shared parts used by Sodium and other related libraries, which will have similar elemental names. Ium seemed like a good possibility. But since the focus is on front-end code, fe-ium. And, of course, FE is iron. So, there you go.

State of this project

Iron is still a early work in progress. I am using it to help me with other projects and have only added functionality that I need and can test. Iron will only grow as it helps me (or other contributers) accomplish what they need. If you need features now, PRs are welcome.

Setup

Clojars Project Dependencies Status

If you want to contribute to this project, you will want to test your changes. You can extend the (very minimal) tests inside Sodium, but you will probably need to really test by using Sodium in a ClojureScript project. The easiest way to do this, while you are changing Iron, is by using Leiningen's checkouts directory feature by sym-linking directly to your copy of Sodium.

Using Iron

Iron is a library, with a grab-bag of functions for re-frame projects. You can use it in several ways:

Helper functions

These are some some of the functions that I've needed often in re-frame projects. I expect this will grow rapidly with time. PRs are welcome here, though I'm likely to be opinionated about what I accept.

In iron.utils

  • negligible? - Variant of empty? that behaves reasonably for non-seqs too
  • ci-compare, ci-sort, ci-sort-by, and ci-includes? - Case-insensitive string functions
  • validate - Wrapper for Clojure specs checking in pre-conditions.
  • vconcat - Like concat, but returns a vector
  • "Camelize" functions - Convert Clojure-style names to JavaScript style

In iron.re-utils

  • sub2 - Shorthand for a simple re-frame 'level-2' subscription (one that simply accesses the db)
  • >evt - Wrapper around re-frame/dispatch, with added sugar for defaults and coersions
  • <sub - Shorthand for re-frame subscribe and immediate deref
  • event->fn - Allow re-frame events to be used in contexts that expect a function
  • sub->fn -Allow re-frame subscriptions to be used in contexts that expect a function
  • check-and-throw - Helper for spec-driven app-db validation.

In iron.chars

Definitions for a few common Unicode characters.

Internals

Testing

lein doo phantom test auto will run the (embarrasingly few) unit tests I've written so far. More are needed. PRs especially welcome here.

Useful references

Questions

I can usually be found on the Clojurians Slack #reagent or #re-frame slack channels. My handle is @deg. Email is also fine.

License

Copyright © 2017-2018, David Goldfarb deg@degel.com

Licensed under the Eclipse Public License.

About

Utilities for re-frame and ClojureScript projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published