Created
June 5, 2018 19:08
-
-
Save airton/9e7ae695885a6591328894ca528eebb0 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
console.log('arrayHashs',arrayHashs) | |
const array = arrayHashs.reduce((prev, curr) => { | |
let newJson = [], | |
json | |
const hasPercent = curr.Hash.indexOf('%') > -1 | |
console.log(curr.Hash.indexOf('%') > -1) | |
if( hasPercent ) { | |
json = decrypt(curr.Hash.split('%')[0]) | |
} else { | |
json = decrypt(curr.Hash) | |
} | |
if(json) { | |
newJson = Object.keys(json).reduce((pr,cur) => { | |
return pr.concat({ 'name': json[cur]['name'], 'email': json[cur]['email']}) | |
}, []); | |
console.log('newJson',newJson) | |
} | |
const newArray = { | |
...newJson[0], | |
'hash': curr.Hash | |
}; | |
return prev.concat(newArray) | |
}, []) | |
console.log('array',array) | |
console.log('array',JSON.stringify(array)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment