D
D
danilr2020-10-14 18:30:23
JavaScript
danilr, 2020-10-14 18:30:23

How to shorten the entry in "or"?

export const isBs = (lead: IData): boolean =>
  lead.processingWay === ProcessingWay.Remote &&
  (lead.identityCheck === IdentityCheck.ESIA || lead.identityCheck === IdentityCheck.SMEV); // тут как-то можно сократить?чтобы не писать два раза lead.identityCheck ===

ProcessingWay and IdentityCheck enums

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
twobomb, 2020-10-14
@danilr

maybe something like this

[IdentityCheck.SMEV,IdentityCheck.ESIA].includes(lead.identityCheck )

X
xmoonlight, 2020-10-14
@xmoonlight

Here it is!

[IdentityCheck.SMEV,IdentityCheck.ESIA].some((a)=>lead.identityCheck===a)
All options can be viewed here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question