-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(headless): abstract function and add comment for reason
- Loading branch information
Showing
5 changed files
with
22 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/api-headless-cms/src/content/plugins/utils/pluralizedTypeName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pluralize from "pluralize"; | ||
|
||
// This will make it so if the content model name is a single capitalized letter | ||
// Ex. A, pluralize will not capitalize the name to AS, and instead make it As | ||
|
||
export const pluralizedTypeName = (typeName: string) => { | ||
let pluralizedTypeName = pluralize(typeName); | ||
if (typeName.length === 1) { | ||
pluralizedTypeName = `${typeName}s`; | ||
} | ||
return pluralizedTypeName; | ||
}; |