Cool code : javascript function arguments destructuring

Posted on: 2017-11-05

Just a cool way to proxy the result of, say, a database query with argument destructuring :

const getUser = id => { return db.user.find({ id }) // returns { name : 'John', passwordHash : 'xxxxx', email : 'john@doe.com' } .then({ name, email } => ({ name, email })); };