Created
January 8, 2020 11:56
-
-
Save DScheglov/668d1ac058f1bf8d7ee80f0e178afb8a to your computer and use it in GitHub Desktop.
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 normalize = (k, v) => ( | |
k !== '' && Array.isArray(v) | |
? { name: v[0], age: v[1], flag: v[2] } | |
: v | |
); | |
const data = JSON.parse( | |
'[["name", 13, true], ["surname", 34, false]]', | |
normalize | |
); | |
console.log(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment