I was reading through this: https://github.com/pburtchaell/redux-promise-middleware/blob/master/src/index.js
I know that ...
is being used as Object spread. I know that !!
is used to convert anything into a boolean with the same truthiness.
However knowing this what do they mean when they're put together like ...!!
? I have trouble understanding the last line here:
{
...resolveAction,
...isAction(rejected) ? rejected : {
...!!rejected && { payload: rejected }
}
...resolveAction
just spreads the keys ofresolveAction
....isAction(rejected) ?
will check ifrejected
resolves an action and then will spread it. (Not sure about this one either)- add
rejected
to object if true {...!!rejected && { payload: rejected }
????????????????
How is ...!!
even valid syntax? There are two options:
If it spreads the object first, then
!!
would be applied to all the spread keysIf
!!
is applied first it's a boolean value and it can't be spread.
So does it make no sense whatsoever, or am I missing something because given that code, I assume it's trying to spread a boolean value.