Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

removes double !! #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

removes double !! #12

wants to merge 1 commit into from

Conversation

abiodun0
Copy link

!!(arr.filter((item) => item.property === prop)[0].html)
this is far easier to read
arr.filter((item) => item.property === prop)[0].html

!!(arr.filter((item) => item.property === prop)[0].html)
this is far easier to read
arr.filter((item) => item.property === prop)[0].html
@thechinedu
Copy link
Owner

thechinedu commented Aug 12, 2016

I'm just casting the value returned to it's boolean equivalent. The tests are failing by the way.

@abiodun0
Copy link
Author

abiodun0 commented Aug 12, 2016

Yup. The reason why the tests are failing were because you were checking for truthy value in essence you should be checking for defined or undefined. which is equivalent as in your use case
if it's defined it will always return true. if it's not it will return false anyways..

It's clean I just feel being more explicit and readability wins here.
Besides isn't this a use case for array.some? 👯

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants