Last active
September 19, 2016 07:24
-
-
Save moleike/874924380a6ff213dd38ec26bc750388 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parseAttributes = payload => payload | |
.split(',') | |
.map(pair => pair.split('=')) | |
.filter(pair => pair.length === 2) | |
.map(([key,val]) => ({ [key]: val })) | |
// > parseAttributes('pmin=5,pmax=40') | |
// [ { pmin: '5' }, { pmax: '40' } ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment