Immutable.js bindings for Ramda

We use both Ramda and Immutable.js extensively in production to get the benefit of persistent data structures, immutability, and a very nice funcitonal api for our code. That said, sometimes it is difficult to reconcile the two libraries, especially when using React/Redux as it is a pain to use toJS everywhere and really destroys a lot of the benefit of using Immutable.js in the first place. It would be nice to integrate the two so you had a fully functional API that could work on both JavaScript objects and Immutable data structures so you didn't have to worry about whether or not the object/data structure you were given has a .get method on it or not. Thankfully with R.invoker, this makes this a bit easier. To wit, to rewrite R.prop to act as either R.prop for JS objects or to take the place of Immutable.Collection.get - we can write something like:

import {
  prop as rProp,
} from 'ramda';

import { iOrR } from './helpers';

const get = invoker(1, 'get');

const prop = curry((k, target) => iOrR(get(k), rProp(k), target));

export default prop;

Here - iOrR is a helper function that discerns whether or not to use get or prop dependent on the data structure, the key is that with invoker (which checks to see if the object has the method listed in the second argument either on the object or its prototype) we are abled to create a curried implementation that is easy to compose. I've created a repo here that will hopefully replace the majority of Immutable.js functions we use with their Ramda counterparts so we can operate on our datastructures without worrying about the exact implementation.