isPlural

Benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js" />

Setup

const NON_PLURAL_WORDS = Object.freeze(['ADDRESS']);
const isPlural = (word) => word.endsWith('S') && !NON_PLURAL_WORDS.includes(word);
const isPlural2 = _.memoize(isPlural);
const words = const words = ['MESSAGE', 'DEAL_SETS', 'DEAL_SET', 'DEALS', 'DEAL', 'ASSETS', 'ASSET', 'ASSET_DETAIL', 'COLLATERALS', 'COLLATERAL', 'SUBJECT_PROPERTY', 'ADDRESS', 'PROPERTY_DETAIL']

Test runner

Ready to run.

Testing in
TestOps/sec
isPlural
words.map(isPlural)
ready
Memoized isPlural
words.map(isPlural2)
ready

Revisions

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