Skip to content

Instantly share code, notes, and snippets.

@toddself
Created July 28, 2016 17:16
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 toddself/2f80e944c99b95ca7f0e6109eedbcfd8 to your computer and use it in GitHub Desktop.
Save toddself/2f80e944c99b95ca7f0e6109eedbcfd8 to your computer and use it in GitHub Desktop.
// params:
// * data:object
// * [key:string]?:string - a key/value pair. both must be strings.
function reduceHash (data) {
return Object.keys(data).reduce((acc, k) => {
acc.push.apply(acc, [k, data[k]])
return acc
}, [])
}
@toddself
Copy link
Author

client.hmset(sessionKey, reduceHash(session), done)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment