In fact there should be a common interface that iterables should implement. I
think this could have been proposed before. This way there would be not more
common methods proposals.
On may. 17 2018, at 10:16 am, Ben Fletcher wrote:
Consider adding the array .map()
> I was about to hit send on a post also suggesting a helper function, but
> after thinking about it a bit more, Rodrigo's suggestion resembles extending
> the optional chaining proposal
>
ategoryId?, postType? })
}
```
De: kai zhu <kaizhu...@gmail.com>
Enviado: martes, 28 de noviembre de 2017 11:43 p.m.
Para: Rodrigo Carranza
Cc: J Decker; Michał Wadas; es-discuss@mozilla.org
Asunto: Re: A way to prevent properties to be added to an object if they are
null or undefined.
and it is acting weird. Also I'm new to mailing lists.
De: J Decker <d3c...@gmail.com>
Enviado: martes, 28 de noviembre de 2017 09:07 p.m.
Para: Michał Wadas
Cc: Rodrigo Carranza; es-discuss@mozilla.org
Asunto: Re: A way to prevent properties to be added to an
Yeah, it was wrong, I'm currently using like
```js
let ret = { ... ( couldBeNull ? {couldBeNull} : {} ) }
```
Yours is better and the usual idiom a bit hard to understand.
What I'm proposing is something like this
```js
let ret = { couldBeNull? }
```
or if you want a different name for the
Yes, like that, but that will require to modify the object.
Compare this
```js
let a = {}
a.field ?= couldBeNull
```
To:
```js
let a = {
field ?: couldBeNull
}
```
Also if you want to set the property with the same name of the variable
```js
let field = ...
let a = {
field?
}
```
Why
Yes, like that, but that will require to modify the object.
Compare this
```js
let a = {}
a.field ?= couldBeNull
```
To:
```js
let a = {
field ?: couldBeNull
}
```
Also if you want to set the property with the same name of the variable
```js
let field = ...
let a = {
field?
}
```
Why
It's about the value of the property to be added, nothing to do with the name
of the property. It should discard properties whose value are null(but this
behavior is not always desired, so a different syntax for these properties
should be added).
```
On nov. 28 2017, at 8:33 pm, Sebastian
A way to prevent properties to be added to an object if they are null or
undefined.
Currently this can be accomplished in many ways:
With an if:
```js
function foo(couldBeNull){
let ret = {}
if(couldBeNull){
ret.couldBeNull = couldBeNull
}
return ret
}
```
With ternary (kind of gross)
```js
9 matches
Mail list logo