Last active
August 6, 2017 11:41
-
-
Save Vilintritenmert/f29f5f2c0e111b43e040ad9925f5a5ea to your computer and use it in GitHub Desktop.
Regexp
This file contains hidden or 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 first = arrayOfData.filter(item=>item.match(/r1/g)) | |
.map(item => { | |
result = item.match(/r1/g); | |
return { | |
name:result[0], | |
surename:result[1] | |
}; | |
}); | |
const second = arrayOfData.filter(item=>item.match(/r2/g)) | |
.map(item => { | |
result = item.match(/r2/g); | |
return { | |
name:result[0], | |
thirdname:result[1], | |
surename:result[2] | |
}; | |
}); | |
const users = [].concat(first, second); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment