Skip to content

Instantly share code, notes, and snippets.

@raine
Created October 4, 2015 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raine/0f640866e0a5f0a24e04 to your computer and use it in GitHub Desktop.
Save raine/0f640866e0a5f0a24e04 to your computer and use it in GitHub Desktop.
const { pickBy } = require('ramda');
const obj = {
a: 1,
b: 2,
A: 3,
B: 4
};
// ---
const keyIsUpperCase = (val, key) =>
key.toUpperCase() === key;
pickBy(keyIsUpperCase, obj);
// ---
const focus = (idx, fn) =>
(...args) => fn(args[idx]);
const isUpperCase = (str) =>
str.toUpperCase() === str;
const keyIsUpperCase_ = focus(1, isUpperCase);
pickBy(focus(1, isUpperCase), obj); // { A: 3, B: 4 }
pickBy(keyIsUpperCase_, obj); // { A: 3, B: 4 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment