String match

Benchmark created on


Description

[ ].some vs [ ].includes vs set.has

Setup

const cases = [
  'auth/token-expired',
  'auth/no-user',
  'auth/invalid-domain'
]

const casesSet = new Set(cases)

Test runner

Ready to run.

Testing in
TestOps/sec
some
cases.some((c) => c === 'auth/invalid-domain')
ready
includes
cases.includes('auth/invalid-domain')
ready
has
casesSet.has('auth/invalid-domain')
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.