From aa3ee7defef2133bdaabb05bc43fd63920c4540b Mon Sep 17 00:00:00 2001 From: David Keijser Date: Sun, 17 Jan 2021 14:49:45 +0100 Subject: [PATCH] Drop plural from count variable Using e.g `fruitCount` instead of `fruitsCount` because it sounds more natural --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7eae88c..6b015ca 100644 --- a/README.md +++ b/README.md @@ -51,11 +51,11 @@ const pages_count = 5 const shouldUpdate = true /* Good */ -const pagesCount = 5 +const pageCount = 5 const shouldUpdate = true /* Good as well */ -const pages_count = 5 +const page_count = 5 const should_update = true ``` @@ -70,13 +70,13 @@ A name must be _short_, _intuitive_ and _descriptive_: ```js /* Bad */ const a = 5 // "a" could mean anything -const isPaginatable = postsCount > 10 // "Paginatable" sounds extremely unnatural -const shouldPaginatize = postsCount > 10 // Made up verbs are so much fun! +const isPaginatable = a > 10 // "Paginatable" sounds extremely unnatural +const shouldPaginatize = a > 10 // Made up verbs are so much fun! /* Good */ -const postsCount = 5 -const hasPagination = postsCount > 10 -const shouldDisplayPagination = postsCount > 10 // alternatively +const postCount = 5 +const hasPagination = postCount > 10 +const shouldDisplayPagination = postCount > 10 // alternatively ``` ## Avoid contractions @@ -111,11 +111,11 @@ A name should reflect the expected result. ```jsx /* Bad */ -const isEnabled = itemsCount > 3 +const isEnabled = itemCount > 3 return