Re: Inline variable dereferencing of object field names

2017-07-23 Thread Logan Smyth
Assuming in your first example you meant

query.$pull[team] = userId;

not

query[team] = userId;

then your second example is already valid a ES6 computed property and does
exactly what you appear to be looking for.

On Sun, Jul 23, 2017 at 8:15 PM, Sebastian Malton 
wrote:

> When creating objects I think that having some notation to make the
> following easier to read
>
> let query = {
> $pull: {}
> };
> query[team] = userId;
>
> I was thinking of borrowing from the above notation and doing the
> following:
>
> let query = {
> $pull: {
> [team]: userId
> }
> };
>
> ___
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Inline variable dereferencing of object field names

2017-07-23 Thread Sebastian Malton
 When creating objects I think that having some notation to make the following easier to readlet query = {    $pull: {}};query[team] = userId;I was thinking of borrowing from the above notation and doing the following:let query = {    $pull: {        [team]: userId    }};  ___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss