Skip to content

Instantly share code, notes, and snippets.

@qur2
Created November 14, 2016 11:13
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 qur2/0968d808e4c32eb5d339495ed4c6a79d to your computer and use it in GitHub Desktop.
Save qur2/0968d808e4c32eb5d339495ed4c6a79d to your computer and use it in GitHub Desktop.
const groupZipObj = R.curry((keys, values) => {
const obj = R.pipe(R.take(keys.length), R.zipObj(keys))
const remain = R.drop(keys.length)
return R.isEmpty(values) ? [] : R.prepend(obj(values), groupZipObj(keys, remain(values)))
})
groupZipObj(['key', 'value'], ['K1', 'V1', 'K2', 'V2', 'K3', 'V3'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment