Because your identity is important.
Switch branches/tags
Nothing to show
Pull request Compare This branch is even with ninjudd:develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/flatland/ego
test/flatland/ego
.gitignore
.travis.yml
LICENSE
README.markdown
project.clj

README.markdown

Build Status

Introduction

Ego is a library for working with a simple id format.

Ego ids are in the format of "type-number". An example id would be "foo-1". This library was created to eliminate duplicated code in a few of our own projects, specifically jiraph and wakeful.

Usage

This library has a single function: split-id. It takes an id and optionally a function for verification.

user=> (split-id "foo-1")
[:foo 1]

And here is an example using verification functions:

user=> (split-id "foo-2" #{:bar :foo})
[:foo 2]
user=> (split-id "foo-2" #{:bar :baz})
java.lang.Exception: node-id foo-2 doesn't match type(s): bar, baz (NO_SOURCE_FILE:0)
user=> (split-id "foo-2" #(= :foo %))
[:foo 2]