The only thing I did not understand how to do this using the new ES syntax is to create an object that is a subset of the other, based on the declared included values.
Here is what I am trying to do:
//input let user = { id: 123, foo: 'foo', bar: 'bar', password: 'hunter2' }; //output let safeUser = { id: user.id, foo: user.foo, bar: user.bar } //NOT this (I don't want to declare excluded vals) let {password, ...safeUser} = user;
If this is not possible, does anyone know if there is anything in the work? I looked at esdiscuss and babel, but nothing appeared.
source share